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: set -g status-justify centre puts the tmux window list in the middle

Tmux
~/tips/tip-tmux-status-justify-centre

set -g status-justify centre

Moves the list of window names from the left of the tmux status bar to the centre.

By default the window list in the tmux status bar sits on the left, right after the session name. I find it easier to scan in the middle, with the session on the left and the clock on the right.

set -g status-justify centre

The option takes four values: left (the default), centre, right and absolute-centre. The difference between the two centre values is small but visible. centre puts the list in the middle of the space that is left between status-left and status-right. absolute-centre uses the middle of the whole line, so the list stays put when the text on the left or right gets longer.

If your status-right shows something that changes width, like a hostname on one machine and a long load average on another, I’d go for absolute-centre. Otherwise the window names shift a few cells every time.

set -g status-justify absolute-centre

Add the line to ~/.tmux.conf and reload, or type it after Ctrl-b : to see it straight away. tmux show -g status-justify tells you what is set now.

Two things to watch. tmux wants the British spelling: set -g status-justify center fails with unknown value: center, which is the kind of error I’d stare at for a minute. And with many windows on a narrow terminal the list does not fit any more. tmux then cuts it and shows a < or > marker at the side that is cut, so shorter window names help more than any position.

Further reading: tmux manual page (OpenBSD), tmux wiki: Formats

Going deeper: Guide: advanced tmux, a config that grows with you, formats, layouts and more

More Tmux tips set -s extended-keys on set -s history-file ~/.tmux_history tmux list-keys -T prefix ] set -g prefix2 C-a bind S run-shell -b '~/bin/sync-notes.sh' All Tmux tips (133) All topics

Link