5

I am trying to create a script that launches tmux with a specific pane layout and size. I am following the tutorial in the following link: https://leanpub.com/the-tao-of-tmux/read#pane-resizing

However when I try to use tmux split-window -p 75 it's more like a 40%/60% split. I've also tried tmux split-window -p 90 to see if I could get a bigger, and more evident, difference in size between the two panes but it doesn't change much.

These is the code that I am using:

#!/bin/sh
tmux new -s abc -d
tmux split-window -p 90
tmux attach -t abc

I know how to create the layout that I want but my problem is getting the pane sizes that I need.

1 Answer 1

11

new-session
[…] With -d, the initial size comes from the global default-size option; -x and -y can be used to specify a different size.

(source)

The default default-size is 80x24. Before customizable default-size was introduced, new-session behaved as if it was 80x24.

What happens is split-window works fine. Then you attach and the layout is recalculated to the new width and height. My observation is tmux tends to keep the size of some pane(s) while resizing, it doesn't keep the relative proportions. I don't think you can change this behavior easily.

Tell new-session to use the size of your terminal:

#!/bin/sh
tmux new-session -s abc -d -x "$(tput cols)" -y "$(tput lines)"
tmux split-window -p 90
tmux attach -t abc
1
  • 1
    Is possible to use "-" for sizes: tmux new-session -s abc -d -x - -y - Dec 5, 2020 at 17:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .