DhP
DhP

Reputation: 316

How to set a maximum width of a "main window" in a tmux layout?

Wondering how i could set an a maximum width (at 80 characters) of the "main" window/pane, of a tmux session that's using default main-vertical layout?

More specifically, i'd like the window pane that's showing iftop to always remain at a maximum of 80 character width, whilst having the (less important) right-side panes to scale in width in relation to the terminal window.

(at my screenresolution, the main pane seems to always extend itself to ~114 characters when the terminal window is maximized, making the 3 vertical and right-side panes rather annoyingly narrow)

I'm aware of the main-pane-width setting , but for some reason i'm having trouble with figuring out where to implement it in the following command, without it failing.

My current tmux command:

#!/bin/sh

tmux \
  new-session -s "Dashboard" "iftop -NpPb ; read" \; \
  split-window  "tor ; read" \; \
  split-window "dnsmasq -q -d -z -a 127.0.0.1 -i lo --server 127.0.0.1#5353 --cache-size=500 ; read" \; \
  split-window "privoxy --no-daemon /etc/privoxy/config ; read" \; \
  select-layout main-vertical

e.g, this command will fail:

tmux \
  new-session -s "Dashboard" "iftop -NpPb ; read" \; \
  split-window  "tor ; read" \; \
  split-window "dnsmasq -q -d -z -a 127.0.0.1 -i lo --server 127.0.0.1#5353 --cache-size=500 ; read" \; \
  split-window "privoxy --no-daemon /etc/privoxy/config ; read" \; \
  select-layout main-vertical \; \
  main-pane-width 80

e.g This seems to have no effect:

tmux \
  new-session -s "Dashboard" "iftop -NpPb ; read" \; \
  split-window  "tor ; read" \; \
  split-window "dnsmasq -q -d -z -a 127.0.0.1 -i lo --server 127.0.0.1#5353 --cache-size=500 ; read" \; \
  split-window "privoxy --no-daemon /etc/privoxy/config ; read" \; \
  select-layout main-vertical \; \
  set-option -t "Dashboard" main-pane-width 80

Upvotes: 0

Views: 1428

Answers (1)

DhP
DhP

Reputation: 316

Figured out that it was select-layout main-vertical that seemingly kept reverting away from any changes i made to the layout.

Seems it's not as easy as trying to using it as a starting template.

Best solution appears to be to construct the needed layout in the command.

Upvotes: 1

Related Questions