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

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.)

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:

Related

When using tmux how can I see the total output of one pane?

I am using an application that uses tmux with multiple panes
I know the basics of how to travel between panes.
So I move to one pane with Ctrl+B and arrows.
Then when I am in one pane that I found interesting I do Ctrl+B Z and I could see the pane as an entire terminal. (Zoom)
The problem is when I am there I can see the latest output of that pane but I cannot go up to see what happened before that. I would like to do that.
How can I scroll the other outputs in a pane in tmux?
You can scroll outputs in tmux by running the following key combinations:
CTRL-B and then the [ key. (Enters "Scroll mode")
You can now use the up and down arrow keys on your keyboard to scroll through the output. To exit, just press ESC or q

Mouse thinks it is in a different tmux pane

I am using tmux 3.0 in bash over ssh on CentOS 7. My tmux.conf is fairly simple. It has some bindings and
set-option -g mouse on
set -g focus-events on
I have a fairly large tmux window with 3 vertical panes. When I move the mouse to the right side of the rightmost pane and do something (e.g. scroll with mouse wheel or click to select this pane). The action gets executed on the leftmost pane instead.
This behavior persists if I detach from and reattach to the session. Any ideas what might be causing this and how to fix it?
Terminal emulators which do not support SGR mouse mode will not correctly report any mouse actions to the right of column 227. Is your terminal emulator window wider than this?
Try using a different terminal emulator.

Is it possible to paste in all tmux panes simultaneously using tmux copy & paste?

If I run tmux with synchronized panes, I can type and have the text appear in all panes at the same time.
Furthermore, if I use the mouse to select text and copy it into the system clipboard, I can paste and have it appear in all panes.
However, if I want to use tmux native copy (prefix-[) and paste (prefix-]), the pasted content appears in only one pane.
Is there a native tmux way to paste in all panes of the current window?
There is no native tmux way so far to achieve it. Because pasting buffer is calling paste-buffer command. It can only be applied on a single pane, with the optional -t.
Your system clipboard approach worked because you were using the send-key (I guess) in key mapping.
What you can try is, if you have synchronized panes, you type in one pane: tmux pasteb, you will see that this command was typed in all panes, however the result/output comes only to your current pane.

Tmux and copy mode with release mouse button

I'm using tmux for the first time as a replacement for iterm (mostly because of the split panels function) and it works great. Now, i have a question about the copy-text behaviour.
It's possible to configure tmux, so i can select text with the left button (in copy mode) and it's automatically copied (to the clipboard) when i release the left button? (same as in irc clients)
Tmux’s select behavior will depend on your mouse settings. If mode-mouse is off, Tmux should stay out of the way. But, by default, it may be set to “on”. Then it will use its own “paste buffer”. To bypass that, you can hold down shift while selecting and pasting. (This works on Linuxes, but probably on Mac, too; not sure what OS you’re on.)

Tmux current pane indicator when focus regained

I'm trying to create a visual indicator of which pane is currently focused in tmux when my terminal (iterm2, OSX) window gains focus. I have found that iterm2 sends a focus gained escape sequence (^[[I) so now I am trying to find how I can capture that and fire the prefix q command which shows pane numbers with the active pane in red.
Any ideas on how to capture the escape sequence in tmux OR in iterm2?
I have a partial solution to my issue which takes a different approach. Since I usually have vim and one terminal pane open, dimming vim when it is not focussed is a good indicator which pane is active. In order to achieve this I have modified the vim-diminactive plugin to react to focus events (https://github.com/blueyed/vim-diminactive/pull/8), this requires the Vitality.vim plugin as well as enabling (focus-events) in tmux options.
In order to completely solve my issue I am working on changing the background colour of terminal panes when they lose focus. I use zsh so I can capture the focus event with bindkey (I have verified this works) to issue a background colour change escape code to iterm2, however this seems to have no effect in tmux.

Resources