WoodBoi
WoodBoi

Reputation: 21

TMUX - Pane Resizing not working when detached?

I've been learning TMUX recently. The main motivation for learning it, is to be able to write shell scripts for layouts. This obviously includes splitting windows into multiple sub-panes with specific heights and widths.

The Problem:

When in an attached tmux session, I can execute this command: Ctrl+b+: -> resize-pane -y 8

This resizes the currently selected (vertical) pane to an absolute amount of 8 lines.

However. When I write a script to perform this action, before the session is attached, it either doesn't work or consider the given number relative instead of absoloute:

tmux new -s test -d
tmux send-keys -t test 'ls /' C-m
tmux split-window -v -t test
tmux resize-pane -t test -y 8       #<--- Not working correctly
tmux send-keys -t test 'ls ~' C-m
tmux attach -t test

Is resize-pane -t accepting not the session name, or something?

Any help appreciated.

Upvotes: 2

Views: 1270

Answers (1)

user11274868
user11274868

Reputation:

The resize probably is working but the unattached session you have created is much smaller that the terminal you then attach to so when you attach tmux will resize the pane.

Try adding -x- -y- to new-session:

tmux new -s test -d -x- -y-

Upvotes: 7

Related Questions