How do I change the background color of the tmux bar to a different color depending on if the client is in copy-mode (or not)?
The goal is to make it extremely clear when the tmux client is in copy-mode.
How to detect copy-mode in a format string
I found #{?#{!=:#{selection_present},},COPY-MODE,NORMAL-MODE}
works.
What I tried
Set status-left
or status-right
This only changes the style of one part of the bar. Example:
set -g status-left '#{?#{!=:#{selection_present},},#[bg=yellow],#[bg=green]}#{=10:session_name}@#{=10:host_short}
This'll show session@hostname
in the bottom left, and it will change background, but does not change the color of the entire status bar.
Set status-style
with a format string
set -F -g status-style 'bg=#{?#{!=:#{selection_present},},yellow,green},fg=black
This appears to evaluate the format strings only once. Note: If I remove the -F
bg does not change.