tmux visual indication if panes are synchronized

Is it possible for tmux to have some visual indicator if synchronized-panes is enabled for the window?

Perhaps the status bar changes to blue, or just a star appears somewhere?

I often set synchronized-panes, leave for a few hours, and come back to forget if it's enabled or not.


Solution 1:

The pane_synchronized format variable can be used with conditional formatting to adjust bits of the various format-using status options.

You could add  SYNC!!! in a blue background to the end of status-right:

set-option -ag status-right '#{?pane_synchronized, #[bg=blue]SYNC!!!#[default],}'

Or you could add blue asterisks around the entry in the window list:

set-option -gw window-status-current-format '#{?pane_synchronized,#[fg=blue]***#[default],}#I:#W#F#{?pane_synchronized,#[fg=blue]***#[default],}'

(the #I:#W#F in the middle is the default format)

You might also want to adjust window-status-format if you want to know when an inactive window’s panes are synchronized.

Solution 2:

These are the lines from my tmux.conf which turn pane sync on and off. In the commands I also set the color of the status bar.

bind C-y set-window-option synchronize-panes on \; set-window-option status-bg red \; display-message "Panes synchronized."
bind C-u set-window-option synchronize-panes off \; set-window-option status-bg green \; display-message "Panes un-synchronized."

This is an incomplete solution for me, because when I switch to another window where panes are not sync, the status bar stays red.