Reputation: 690
I have a small script which turns my terminal into a monitoring view for the GPU. The nvidia-smi -l 1
command I run in one of the panes requires it to be a certain height though, which I can calculate based on the number of GPU processes using
smi_processes=$(nvidia-smi pmon -c 1 | wc -l)
smi_height=$((${smi_processes} + 3))
(Have not done proper calculations yet.) I want this process to run in the top right pane though, but don't know how I can assign that pane a certain height. I can define the height of the bottom right pane just fine. This is my current script:
smi_processes=$(nvidia-smi pmon -c 1 | wc -l)
smi_height=$((${smi_processes} + 3))
tmux \
new-session 'htop' \; \
split-window -h 'nvidia-smi -l 1' \; \
split-window -v \; \
split-window -v 'xdotool key F11'\; \
This will split the right two panes evenly and then set the terminal to full screen. I can define the bottom pane's height with split-window -v -l [height] \; \
but this would mean the top window will have different heights on different size monitors, or different terminal settings.
I tried spawning the process in the bottom pane, sizing it and then swapping the pane up using swap-pane -U
, but the size is linked to the bottom pane.
TL;DR:
How can I have the top right pane be a certain height, and the bottom right pane to take up the rest of the space?
Thanks in advance!
Upvotes: 4
Views: 1957
Reputation: 690
Fixed it by moving the fullscreen command and by using resize-pane -y
and select-pane
:
smi_processes=$(nvidia-smi pmon -c 1 | wc -l)
smi_height=$((${smi_processes} + 5))
tmux \
new-session 'htop' \; \
split-window -h 'nvidia-smi -l 1' \; \
split-window -v \; \
split-window -v 'xdotool key F11'\; \
select-pane -t 1 \; \
resize-pane -y $smi_height \; \
select-pane -t 2 \; \
Upvotes: 2