Skip to main content
added 837 characters in body
Source Link
meuh
  • 54.7k
  • 2
  • 70
  • 139

It's not too clear what layout you are looking for, but here is a demo bash script that may provide you with some ideas. One problem is that select-layout even-vertical will remove any column structure you have developed, and place all the panes vertically. So the approach here is to first create the vertical structure of rows, equalise their spacing, then split each pane horizontally. This image shows the result. The text shown in each pane is just a hint as to the real command you would run there, and the aa bb cc are just a simplified pod_name from your code. Each pane is titled with the pane_index which changes all the time, and the %pane_id which does not.

xterm tmux layout Here

Here is the bash script, which shouldn't be too exotic for MacOS, but you'll have to try for yourself.

#!/bin/bash session_uuid=mysession DISPLAY=:0 xterm -title ttmux -geometry 60x30-1+1 \ -e "tmux new-session -s $session_uuid 'sleep 20'" & sleep 2 tmux set -g pane-border-status bottom tmux set -g pane-border-format "#{pane_index} #{pane_id}" declare -a names for pod_name in aa bb cc do names+=($pod_name) done declare -A pane_ids for pod_name in ${names[@]} do tmux split-window -v -t "$session_uuid" "echo kubectl logs '$pod_name';sleep 999" pane_ids[$pod_name]=$(tmux display -p '#{pane_id}') done tmux kill-pane -t "$session_uuid:0.0" tmux select-layout even-vertical # removes columns! for pod_name in ${names[@]} do pane_id=${pane_ids[$pod_name]} tmux split-window -h -t "$pane_id" "echo 'Second Column' $pod_name;sleep 999" tmux display-panes done 

The script starts by creating a new terminal to run tmux with a dummy command, just so it is easy to see the progress. In the first for loop, the bash array names is used to collect the pod_name, as in the loop in your script. The second for loop creates a new vertical pane, and "runs" the "kubectl" command. It retrieves the unique pane_id and saves it in the bash associative array pane_ids, using the pod_name as key.

We then kill the dummy pane, and spread the panes out evenly with select-layout even-vertical. The final for loop splits each pane horizontally, using the pod_name and unique pane_id, and "runs" some other command.

It's not too clear what layout you are looking for, but here is a demo bash script that may provide you with some ideas. One problem is that select-layout even-vertical will remove any column structure you have developed, and place all the panes vertically. So the approach here is to first create the vertical structure of rows, equalise their spacing, then split each pane horizontally. This image shows the result. The text shown in each pane is just a hint as to the real command you would run there, and the aa bb cc are just a simplified pod_name from your code. Each pane is titled with the pane_index which changes all the time, and the %pane_id which does not.

xterm tmux layout Here is the bash script, which shouldn't be too exotic for MacOS, but you'll have to try for yourself.

#!/bin/bash session_uuid=mysession DISPLAY=:0 xterm -title ttmux -geometry 60x30-1+1 \ -e "tmux new-session -s $session_uuid 'sleep 20'" & sleep 2 tmux set -g pane-border-status bottom tmux set -g pane-border-format "#{pane_index} #{pane_id}" declare -a names for pod_name in aa bb cc do names+=($pod_name) done declare -A pane_ids for pod_name in ${names[@]} do tmux split-window -v -t "$session_uuid" "echo kubectl logs '$pod_name';sleep 999" pane_ids[$pod_name]=$(tmux display -p '#{pane_id}') done tmux kill-pane -t "$session_uuid:0.0" tmux select-layout even-vertical # removes columns! for pod_name in ${names[@]} do pane_id=${pane_ids[$pod_name]} tmux split-window -h -t "$pane_id" "echo 'Second Column' $pod_name;sleep 999" tmux display-panes done 

It's not too clear what layout you are looking for, but here is a demo bash script that may provide you with some ideas. One problem is that select-layout even-vertical will remove any column structure you have developed, and place all the panes vertically. So the approach here is to first create the vertical structure of rows, equalise their spacing, then split each pane horizontally. This image shows the result. The text shown in each pane is just a hint as to the real command you would run there, and the aa bb cc are just a simplified pod_name from your code. Each pane is titled with the pane_index which changes all the time, and the %pane_id which does not.

xterm tmux layout

Here is the bash script, which shouldn't be too exotic for MacOS, but you'll have to try for yourself.

#!/bin/bash session_uuid=mysession DISPLAY=:0 xterm -title ttmux -geometry 60x30-1+1 \ -e "tmux new-session -s $session_uuid 'sleep 20'" & sleep 2 tmux set -g pane-border-status bottom tmux set -g pane-border-format "#{pane_index} #{pane_id}" declare -a names for pod_name in aa bb cc do names+=($pod_name) done declare -A pane_ids for pod_name in ${names[@]} do tmux split-window -v -t "$session_uuid" "echo kubectl logs '$pod_name';sleep 999" pane_ids[$pod_name]=$(tmux display -p '#{pane_id}') done tmux kill-pane -t "$session_uuid:0.0" tmux select-layout even-vertical # removes columns! for pod_name in ${names[@]} do pane_id=${pane_ids[$pod_name]} tmux split-window -h -t "$pane_id" "echo 'Second Column' $pod_name;sleep 999" tmux display-panes done 

The script starts by creating a new terminal to run tmux with a dummy command, just so it is easy to see the progress. In the first for loop, the bash array names is used to collect the pod_name, as in the loop in your script. The second for loop creates a new vertical pane, and "runs" the "kubectl" command. It retrieves the unique pane_id and saves it in the bash associative array pane_ids, using the pod_name as key.

We then kill the dummy pane, and spread the panes out evenly with select-layout even-vertical. The final for loop splits each pane horizontally, using the pod_name and unique pane_id, and "runs" some other command.

added 837 characters in body
Source Link
meuh
  • 54.7k
  • 2
  • 70
  • 139

It's not too clear what layout you are looking for, but here is a demo bash script that may provide you with some ideas. One problem is that select-layout even-vertical will remove any column structure you have developed, and place all the panes vertically. So the approach here is to first create the vertical structure of rows, equalise their spacing, then split each pane horizontally. This image shows the result. The text shown in each pane is just a hint as to the real command you would run there, and the aa bb cc are just a simplified pod_name from your code. Each pane is titled with the pane_index which changes all the time, and the %pane_id which does not.

xterm tmux layout Here is the bash script, which shouldn't be too exotic for MacOS, but you'll have to try for yourself.

#!/bin/bash session_uuid=mysession DISPLAY=:0 xterm -title ttmux -geometry 60x30-1+1 \ -e "tmux new-session -s $session_uuid 'sleep 20'" & sleep 2 tmux set -g pane-border-status bottom tmux set -g pane-border-format "#{pane_index} #{pane_id}" declare -a names for pod_name in aa bb cc do names+=($pod_name) done declare -A pane_ids for pod_name in ${names[@]} do tmux split-window -v -t "$session_uuid" "echo kubectl logs '$pod_name';sleep 999" pane_ids[$pod_name]=$(tmux display -p '#{pane_id}') done tmux kill-pane -t "$session_uuid:0.0" tmux select-layout even-vertical # removes columns! for pod_name in ${names[@]} do pane_id=${pane_ids[$pod_name]} tmux split-window -h -t "$pane_id" "echo 'Second Column' $pod_name;sleep 999" tmux display-panes done 

It's not too clear what layout you are looking for, but here is a demo bash script that may provide you with some ideas. One problem is that select-layout even-vertical will remove any column structure you have developed, and place all the panes vertically. So the approach here is to first create the vertical structure of rows, equalise their spacing, then split each pane horizontally. This image shows the result. The text shown in each pane is just a hint as to the real command you would run there, and the aa bb cc are just a simplified pod_name from your code. Each pane is titled with the pane_index which changes all the time, and the %pane_id which does not.

xterm tmux layout Here is the bash script, which shouldn't be too exotic for MacOS, but you'll have to try for yourself.

It's not too clear what layout you are looking for, but here is a demo bash script that may provide you with some ideas. One problem is that select-layout even-vertical will remove any column structure you have developed, and place all the panes vertically. So the approach here is to first create the vertical structure of rows, equalise their spacing, then split each pane horizontally. This image shows the result. The text shown in each pane is just a hint as to the real command you would run there, and the aa bb cc are just a simplified pod_name from your code. Each pane is titled with the pane_index which changes all the time, and the %pane_id which does not.

xterm tmux layout Here is the bash script, which shouldn't be too exotic for MacOS, but you'll have to try for yourself.

#!/bin/bash session_uuid=mysession DISPLAY=:0 xterm -title ttmux -geometry 60x30-1+1 \ -e "tmux new-session -s $session_uuid 'sleep 20'" & sleep 2 tmux set -g pane-border-status bottom tmux set -g pane-border-format "#{pane_index} #{pane_id}" declare -a names for pod_name in aa bb cc do names+=($pod_name) done declare -A pane_ids for pod_name in ${names[@]} do tmux split-window -v -t "$session_uuid" "echo kubectl logs '$pod_name';sleep 999" pane_ids[$pod_name]=$(tmux display -p '#{pane_id}') done tmux kill-pane -t "$session_uuid:0.0" tmux select-layout even-vertical # removes columns! for pod_name in ${names[@]} do pane_id=${pane_ids[$pod_name]} tmux split-window -h -t "$pane_id" "echo 'Second Column' $pod_name;sleep 999" tmux display-panes done 
Source Link
meuh
  • 54.7k
  • 2
  • 70
  • 139

It's not too clear what layout you are looking for, but here is a demo bash script that may provide you with some ideas. One problem is that select-layout even-vertical will remove any column structure you have developed, and place all the panes vertically. So the approach here is to first create the vertical structure of rows, equalise their spacing, then split each pane horizontally. This image shows the result. The text shown in each pane is just a hint as to the real command you would run there, and the aa bb cc are just a simplified pod_name from your code. Each pane is titled with the pane_index which changes all the time, and the %pane_id which does not.

xterm tmux layout Here is the bash script, which shouldn't be too exotic for MacOS, but you'll have to try for yourself.