4

I set up 2 tmux sessions to work on different parts of a project (switching back and forth frequently). As their layout are pretty similar, I would like to set different status-bar color to help me quickly identify the current session.

After reading the manual, it seems that

set -t session_name status-bg blue

would be what I am looking for. But running that command changes both session status-bar color. Is it possible to achieve a per-session styling in tmux ?

I also tried naming the window and pass its name to -t but was no more successful.

Can't find that information. Also, I might not get tmux session use-case right.

  • Shameless plug: I wrote a script that colors each new tmux session with a new color. – Alexander Rodin May 27 '17 at 8:36
1

You can try playing with hooks. Here is an example that I did for two sessions,

set-hook -g after-new-session 'if -F "#{==:#{session_name},emacs}" "source ~/.tmux/.tmux.conf.emacs" "source ~/.tmux/.tmux.conf.amos"'
set-hook -g after-new-window 'if -F "#{==:#{session_name},emacs}" "source ~/.tmux/.tmux.conf.emacs" "source ~/.tmux/.tmux.conf.amos"'

Be aware that after-new-window hook is necessary.

You can find my whole setup in github.

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.