Is it possible to have a different status-bg color when in an ssh session?

Say I have the default green one, but would like it to turn red when in a ssh session.

Should work when switching windows as well (probably parsing the hostname whilst switching + refresh-client -S)

  • Partial answer: Ctrl-B :set status-bg red (although I suspect you're seeking to automate this better/easier... might be easier to do by using a script that runs ssh) – TOOGAM May 25 '16 at 7:26
  • status-bg and its friends was deprecated in 1.9. Use status-style instead. – starfry Feb 13 '17 at 20:26

In your ~/.tmux.conf add the following two code lines in sequence

Set the normal color

set -g status-bg colour5

Set the ssh color

if-shell -b ' [ "$SSH_CLIENT" ] ' "set -g status-bg colour6"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.