16

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.

3 Answers 3

17

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.

2
  • 4
    Thank you for the tips! I combined it with unicode characters to produce the following window labels: " #{?pane_synchronized,⛓ , }#W ".
    – kstep
    Oct 19, 2015 at 13:10
  • 1
    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, 2019 at 16:25
1

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.

0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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