brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: client_prefix shows in the tmux status bar when you pressed the prefix

Tmux
~/tips/tip-tmux-prefix-indicator

set -g status-right '#{?client_prefix,#[reverse] PREFIX #[noreverse],} %H:%M'

Gives you a visible sign that tmux is waiting for a key.

Did that Ctrl-b land, or not? Without feedback it’s easy to type the next key into the shell instead. A small marker in the status bar answers it.

set -g status-right '#{?client_prefix,#[reverse] PREFIX #[noreverse],} %H:%M'

#{?client_prefix,A,B} is a conditional: client_prefix is 1 right after you pressed the prefix, so tmux shows A, and B otherwise. Here A is the word PREFIX in reversed colours and B is empty. The clock after it stays as it was.

A variant I like is changing the colour of the session name on the left instead of adding a word:

set -g status-left '#[#{?client_prefix,bg=red,bg=green}] #S #[default] '

Remember that this replaces your whole status-right or status-left. Print the old value with tmux show -gv status-right first and paste your marker into it if you want to keep what is there.

The status bar is redrawn when you press the prefix, so the marker appears without waiting for status-interval. If you build your own key tables, client_key_table is the format that tells you which table is active.

Further reading: tmux manual page (OpenBSD)

More Tmux tips tmux new -d -s report -x 200 -y 50 'top' tmux wait-for build-done set -g allow-passthrough on tmux kill-server Ctrl-b [ All Tmux tips (125) All topics

Link