0

As per the tmux man page, tmux contains many variables (e.g. window_zoomed_flag) that can be conditionally displayed in the status bar (e.g. #{window_zoomed_flag,ON,OFF}).

I am looking for a variable / flag that would indicate whether the mouse mode is ON or OFF (i.e. controlled by set -g mouse on / set -g mouse off), with the intent of displaying it in the status bar, similarly to that window_zoomed_flag.

There are some variables related to mouse in tmux 2.8:

 mouse_all_flag                  Pane mouse all flag
 mouse_any_flag                  Pane mouse any flag
 mouse_button_flag               Pane mouse button flag
 mouse_line                      Line under mouse, if any
 mouse_sgr_flag                  Pane mouse SGR flag
 mouse_standard_flag             Pane mouse standard flag
 mouse_utf8_flag                 Pane mouse UTF-8 flag
 mouse_word                      Word under mouse, if any
 mouse_x                         Mouse X position, if any
 mouse_y                         Mouse Y position, if any

However none of them seem to indicate whether mouse mode is ON. Am I missing something? Is there a way to detect whether mouse mode is on, other than using variables?

1 Answer 1

1

The manual states [emphasis mine]:

Format variables are enclosed in #{ and }, for example #{session_name}. The possible variables are listed […], or the name of a tmux option may be used for an option's value. […] Conditionals are available by prefixing with ? and separating two alternatives with a comma.

Try #{mouse} or #{?mouse,ON,OFF}.

It will show the effective value, i.e. the non-global option if set to any value, otherwise the global option.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .