title: Tmux conditional color setting
body: <p>Is it possible to set window color depends on the other window-option?</p>
  
  <p>When a windows has <code>synchronize-panes</code> enabled, I don't want to accidentally press <code>C-d</code>, or all panes will be closed.</p>
  
  <p>So what I'm trying to do is to change window color on statusline based on <code>synchronize-panes</code>:
  (the following config doesn't work, though)</p>
  
  <pre><code>bind-key S setw synchronize-panes \; \  # toggles the option
             set -w window-status-bg '#{?pane_synchronized,yellow,default}' \; \  # error: bad color
             set -w window-status-current-fg '#{?pane_synchronized,yellow,default}'  # error: bad color
  </code></pre>
  
  <p>The most possible solution I can thought of is to use <code>if-shell</code>, but I prefer not to fork a shell just to read option of itself, if possible.</p>
  
  <hr>
  
  <p>EDIT: This <code>if-shell</code> solution works for me on tmux 2.7</p>
  
  <p>My statusline cyan colored, if <code>synchronize-panes</code> is enabled, cyan becomes yellow.</p>
  
  <pre><code>bind-key S setw synchronize-panes \; \
             if-shell '[ #{pane_synchronized} -eq 1 ]' \
                 'set -w window-status-style fg=black,bg=yellow ; set -w window-status-current-style fg=yellow,bg=black' \
                 'set -w window-status-style fg=black,bg=cyan ; set -w window-status-current-style fg=cyan,bg=black'
  </code></pre>
  
  <hr>
  
  <p>EDIT: Problem solved, my setting is now changed to this:</p>
  
  <pre><code>bind-key S setw synchronize-panes
  
  sync_ind_colour="#{?pane_synchronized,yellow,cyan}"
  set -g window-status-format "#[fg=black,bg=${sync_ind_colour}][#I#{?#{!=:#W,},:,}#W]"
  set -g window-status-current-format "#[fg=${sync_ind_colour},bg=black][#I#{?#{!=:#W,},:,}#W]"
  </code></pre>
  
  <p>Looks a little bit scary but it's still readable.</p>