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.

| improve this question | | | | |

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.

| improve this answer | | | | |
  • 3
    Thank you for the tips! I combined it with unicode characters to produce the following window labels: " #{?pane_synchronized,β›“ , }#W ". – kstep Oct 19 '15 at 13:10
  • went with a little more bloated solution, and FWR my 🧠 thinks πŸŠβ€β™€οΈ when thinking about the word synchronize πŸ€·β€β™‚οΈ # styles for windows ## styles for current active window setw -g window-status-current-format "#[fg=#000000]#[bg=colour208] #I:#W#{?window_zoomed_flag,πŸ”,}#{?pane_synchronized,πŸŠβ€β™€οΈπŸŠβ€β™€οΈ,}" ## styles for inactive windows, ie. background windows setw -g window-status-format "#I:#W#{?window_zoomed_flag,πŸ”,},#{?pane_synchronized,πŸŠβ€β™€οΈπŸŠβ€β™€οΈ,}" And yeah the mag lens looks like a ping pong paddle ...gotta work on that one. – ipatch Mar 16 '19 at 16:25

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.

| improve this answer | | | | |

here's what I use in my config:

set -g status-left " #[fg=white,bold][#h] #{?pane_synchronized,#[fg=green]SYNC ,#[fg=yellow]SYNC }"

It'll display the hostname on the left side of the status bar, then the word "SYNC" in green if it's synchronized and yellow if not.

| improve this answer | | | | |

Your Answer

By clicking β€œPost Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.