iconoclast
iconoclast

Reputation: 22670

In tmux, can I show pane titles only when there are multiple panes?

I use tmux all the time, but I only use multiple panes in about 20% of my many tmux windows, and the pane status line showing up when there is only one pane is not helpful to me. I would like to only see it when there are multiple panes, including when I'm zoomed in on one of them (thus reminding me that there are others).

Can I achieve this with any released versions of tmux? (3.2a at the moment, but if it becomes available in later versions I'm of course still interested in knowing about it.)

Upvotes: 1

Views: 539

Answers (1)

atomicstack
atomicstack

Reputation: 809

Try adding this to your .tmux.conf:

set-hook -g -w pane-focus-in "set-option -Fw pane-border-status '#{?#{e|>:#{window_panes},1},top,off}'"

It will create a hook that runs on the pane-focus-in event, which calls set-option for pane-border-status.

The final parameter to set-option is a format string containing a conditional such that, if the current window has more than one pane (#{window_panes} > 1), pane-border-status is set to the value top; else, it is set to the value off.

When I test this, windows with a single pane have no pane border/title. When one or more additional panes are created, the border appears:

asciicast

Upvotes: 4

Related Questions