Reputation: 4178
I am pretty new to tmux and have been using it for now a week or so. I want the tmux window titles to be set to the current program i am running like vim/htop etc and not to the host i am connected to.
Below is my config and as per tmux man page #W
is used for that however it does not seem to work in my case and my window titles are always being set as fqdn[username]
set -g status on
set -g status-interval 1
set -g status-fg colour231
set -g status-bg colour234
set -g status-left-length 20
set -g status-left '#{?client_prefix,#[fg=colour254]#[bg=colour31]#[bold],#[fg=colour16]#[bg=colour254]#[bold]} #S #{?client_prefix,#[fg=colour31]#[bg=colour234]#[nobold],#[fg=colour254]#[bg=colour234]#[nobold]}'
set -g window-status-format "#[fg=colour244,bg=colour234]#I #[fg=colour240] #[default]#W "
set -g window-status-current-format "#[fg=colour234,bg=colour31]#[fg=colour117,bg=colour31] #I #[fg=colour231,nobold]#W #[fg=colour31,bg=colour234,nobold]"
set -g window-status-last-style fg=colour31
set-window-option -g window-status-fg colour249
set -g status-right-length 150
set -g status-right "#[fg=colour225,bg=colour234]#[fg=colour234,bg=colour225] #(date +%a' '%b' '%d) %H:%M#[fg=colour234]#[bg=colour234]#{?pane_synchronized,#[bg=colour236]#[fg=colour160]#[fg=colour255]#[bg=colour160] PANES-ARE-SYNCED !! #[fg=colour234]#[bg=colour=234],#[fg=colour22]#[fg=colour255]#[bg=colour22] PANES-NOT-SYNCED #[fg=colour234]#[bg=colour234]}#[fg=colour255,bg=colour234]#[fg=colour234,bg=colour255,bold]#h"
So can anyone please let me know how do i do it.
Upvotes: 1
Views: 1056
Reputation: 462
I found that on some machines I would get a username@hostname:~
and on others I would get the name of the executable. On both machines tmux show -gw
showed:
automatic-rename on
automatic-rename-format "#{?pane_in_mode,[tmux],#{pane_current_command}}#{?pane_dead,[dead],}"
So I wondered what was happening... it turns out that the option allow-rename
was on
where I could see username@hostname:~
and off
where I saw the current executable name.
allow-rename
makes it possible for your shell (in my case bash) to change the pane title with an escape sequence and in some configurations (for example if your TERM
environment variable starts with screen
) the title will be updated every time your prompt is shown (this is more of a shell related issue so if you are interested please look for information on PS1
and in /etc/bash/bashrc
). To see the effect try this:
echo -en '\033kTMUXISCOOL\033]' ; sleep 5
When you run that command in tmux
you should see the current pane title change to TMUXISCOOL
for 5 seconds then back to username@hostname:~
. By putting the following line into ~/.tmux.conf
:
set -g allow-rename off
The pane title should display the current executable... or whatever is in automatic-rename-format
.
Upvotes: 1