Tmux: Auto hide pane-border-status line when only one pane is displayed

Created on 6 Oct 2016  路  4Comments  路  Source: tmux/tmux

Not a bug, a feature request.
The new pane-border-status option is great, I love it. But it would be even better if it had an auto-hide switch. It would hide border status line whenever only one pane is displayed (including zoomed pane).

Most helpful comment

The OP also mentioned zoomed panes. This can be done with after-resize-pane. I've come up with this:

set-hook -g 'after-resize-pane'  "if-shell -F '#{||:#{==:#{window_panes},1},#{window_zoomed_flag}}' 'set -g pane-border-status off' 'set -g pane-border-status bottom'"

Using if-shell -F means that no sh process is even needed.

All 4 comments

This is why we wrote hook support.

Try these. you may need to tweak some of the values.

set-hook -g 'after-new-window' 'run-shell -b "if [ \#{window_panes} -eq 1 ]; then tmux set pane-border-status; fi"'
set-hook -g 'after-kill-pane' 'run-shell -b "if [ \#{window_panes} -eq 1 ]; then tmux set pane-border-status; fi"'
set-hook -g 'after-split-window' 'run-shell -b "if [ \#{window_panes} -gt 1 ]; then tmux set pane-border-status; fi"'

Nice trick! But, tmux set pane-border-status just toggles, so it doesn't work as expected. Plus, it needs to toggle when pane exits as well.

I've come up with:

# Auto hide pane-border-status line when only one pane is displayed (see tmux/tmux#566)
set-hook -g 'after-new-window'   'run-shell -b "if [ \#{window_panes} -eq 1 ]; then tmux set pane-border-status off; fi"'
set-hook -g 'after-kill-pane'    'run-shell -b "if [ \#{window_panes} -eq 1 ]; then tmux set pane-border-status off; fi"'
set-hook -g 'pane-exited'        'run-shell -b "if [ \#{window_panes} -eq 1 ]; then tmux set pane-border-status off; fi"'
set-hook -g 'after-split-window' 'run-shell -b "if [ \#{window_panes} -gt 1 ]; then tmux set pane-border-status top; fi"'

The OP also mentioned zoomed panes. This can be done with after-resize-pane. I've come up with this:

set-hook -g 'after-resize-pane'  "if-shell -F '#{||:#{==:#{window_panes},1},#{window_zoomed_flag}}' 'set -g pane-border-status off' 'set -g pane-border-status bottom'"

Using if-shell -F means that no sh process is even needed.

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kevinhwang91 picture kevinhwang91  路  3Comments

alfredopalhares picture alfredopalhares  路  4Comments

atweiden picture atweiden  路  4Comments

edouard-lopez picture edouard-lopez  路  4Comments

geoherna picture geoherna  路  4Comments