tmuxp icon indicating copy to clipboard operation
tmuxp copied to clipboard

main-pane default layouts not getting reasonable sizes

Open oblitum opened this issue 7 years ago • 11 comments

For the following session:

session_name: foo
windows:
- layout: main-vertical
  panes:
  - blank
  - blank
  - blank

The result is:

screenshot

Where the main pane is the left one, it's smaller than the others non main panes.

  • tmuxp load -d ./foo.yaml
  • tmux 2.6/2.5
  • tmuxp 1.3.5/1.3.2
  • libtmux 0.7.7/0.7.1

oblitum avatar Nov 10 '17 17:11 oblitum

@oblitum reported this in #309/#312

https://github.com/tony/tmuxp/pull/312#issuecomment-343378282

https://github.com/tony/tmuxp/pull/312#issuecomment-343377844

I have experienced the same issue since 2.6

tony avatar Nov 10 '17 17:11 tony

I'm getting this behavior with vanilla tmux

outside of tmux:

# create a fresh tmux client/server with no config
tmux -L test -f /dev/null

inside the new tmux session:

tmux setw main-pane-width 30
tmux split-window
tmux selectl main-vertical

tony avatar Nov 10 '17 17:11 tony

@oblitum can you reproduce https://github.com/tony/tmuxp/issues/314#issuecomment-343540022?

I experienced the same issue as @oblitum. However, for me it began when using tmux 2.6. The main-pane-height and main-pane-width began being smaller, requiring me to make a larger value for it.

If I set to 30, it's 30 characters/cells wide.

If I set to 60, it's 60 cells wide.

I guess it's more accurate now?

However, the issue I have with this is I don't want a number of cells, I want a percentage (just like what we -p gives in splitw, but I want it to automatically adjust with selectl). Here's what I did with a main-horizontal layout to make it work via proportions: https://github.com/tony/tmux-config/blob/092ef9b/.tmux.conf#L73

bind m run-shell "tmux setw main-pane-height $(expr $(tmux display -p '#{window_height}') / 3 \* 2); tmux select-layout main-horizontal"

I guess the equivalent with main-pane-width would be:

bind m run-shell "tmux setw main-pane-width $(expr $(tmux display -p '#{window_width}') / 3 \* 2); tmux select-layout main-vertical"

Down the line: we could make it so tmuxp set main-pane-{width/height} to a percentage via the config. In fact, we could actually make the percentage persist by creating a hook on client-resized.

tony avatar Nov 10 '17 18:11 tony

I experienced the same issue as @oblitum. However, for me it began when using tmux 2.6

I have the same behavior for the issue's test case on tmux 2.5.

Regarding the other manual width setting, I have never used those, I have only set width/height inside tmuxp's yamls. I think I do prefer the way it's working, I see no issue or change regarding this, for example, I have several yaml's where I set main-pane-width: 160, and it has always worked, and still is, as I'd expect. So, this is solely a matter of the defaults for "main layouts" being saner.

oblitum avatar Nov 10 '17 19:11 oblitum

I have just tested this on tmux 2.5, tmuxp 1.3.2. The behavior is still the same. So I think I may only have noticed this meanwhile the recent issues. I don't know at which point it ever started to behave differently than I'd expect.

Still, main-pane-width, etc, is working as it was before, so I don't expect its behavior to change.

oblitum avatar Nov 10 '17 19:11 oblitum

@oblitum I made a script to resize by % https://devel.tech/tips/n/tMuXrSz9/resize-tmux-main-panes-by-percentage/ / https://github.com/tony/tmux-config/blob/master/scripts/resize-adaptable.sh

tony avatar Nov 26 '17 16:11 tony

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

This bot is used to handle issues where the issue hasn't been discussed or has gone out of date. If an issue isn't resolved and handled in a certain period of time, it may be closed. If you would like your issue re-opened, please create a fresh issue with the latest, up to date information and mention this issue in it.

stale[bot] avatar Jan 25 '18 16:01 stale[bot]

Can we reopen this issue? I'm on tmux 3.1c and cannot get main-pane-width to work.

Abdull avatar Feb 03 '22 09:02 Abdull

@Abdull Absolutely! Re-opened

tony avatar Feb 03 '22 10:02 tony

What about now in 1.13.1? I think it might be solved already

categulario avatar Aug 26 '22 20:08 categulario

Setting e.g. main-pane-width: '60%' works for me (tmuxp 1.24.0, tmux 3.3a). I would suggest making such a percentage the default value of main-pane-width / main-pane-height, to avoid the counter-intuitive behavior described in the original issue description.

denisw avatar Jan 05 '23 08:01 denisw