I’d like to see the status bar only after the prefix key has been sent. I’d like the bar to disappear again as soon as I’ve sent the intended command.

I’d imagine it to work like this:

  1. press C-b (send prefix)
  2. status bar appears
  3. press c (for example)
  4. status bar disappears & new window is created

Do you have any suggestions about how to approach this? Thank you!

2 Answers 2


This is difficult to do simply.

It is easy to make it appear when you press the prefix, just unset the prefix option and bind a key instead:

set -g prefix None
bind -n C-b set status on \; switchc -Tprefix

The problem is persuading it to turn off when a key is pressed, because there is no hook for "any command happened". You could change other key bindings to turn it off, so c becomes:

bind c set status off \; new-window

But that would be a pain to do for every key.

Alternatively, you could just make it turn off after a second or so regardless, with something like:

set -g prefix None
bind -n C-b set status on \; run -b "sleep 1; tmux set -t'#{session_id}' status off" \; switchc -Tprefix

But that may be annoying if you want to do multiple commands one after another. Although you could probably script something more sophisticated than this - perhaps update the time C-b is pressed in a user option and only turn the status off again if it has been long enough.

If you must have it turn off as soon as the next key is pressed, you are left with either changing every other key binding, or modifying tmux to fire a hook you can use.

  • Okay, thank you. Also considering everything I could previously figure out myself, these approaches seem reasonable. Thanks!
    – smeikx
    Mar 4, 2020 at 11:04

I made a small change in the Nicholas suggestion and I could achieve the result.

bind -n C-b set status on \;\
  switch-client -T prefix \;\
  run-shell -d 1 -b "while [ $(tmux display-message -p '##{client_prefix}') -eq 1 ]; do sleep 0.5; done; tmux set status off"

You must log in to answer this question.

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