Hello list,

I'm trying to transition from GNU Screen to tmux.  I like to have my
windows named as the host they are logged into.  That is, until I run
a command.  Then I like to have it named for the command I'm running.

In GNU Screen, I accomplished this via the PS1 environment variable.
(some shells in various OSes do not support PROMPT_COMMAND)

In Linux:
export PS1="\[\033]0;${us...@${hostname}\007\]"  ##display u...@host
in titlebar or "%h" screen string escape
export PS1=${PS1}'\[\033k\033\\\]'  ##display running command for
window name in screen's caption line (empty the current name)
export PS1=${PS1}'\[\033k'${HOSTNAME}'\033\\\]'  ##show hostname for
window name on screen's caption line when idle
export PS1='<\...@\h:\w>\n'${PS1}'\$ '

I place this code in my .bashrc or .profile of each host I ssh into.
It works great in screen.

When I try this in tmux, it sets the window name (#W) to the hostname
of the system i'm logged into great, but it fails to set it to a
running command (example: top, sar, etc...)

I believe this is due to the fact that I tell screen what a prompt
looks like via this config:
shelltitle "$ |idle"

I'm not quite sure how to accomplish this with tmux.  I have tried
setw -g automatic-rename on, but from what I've read, after the first
rename (my PS1 being set), it disables this feature for the window.

Can anyone provide any ideas or solutions that will acknowledge the
escape sequence I'm using for setting the window, yet override it when
a command is run?  Perhaps there is a config directive I'm
overlooking.  Perhaps there's something even easier and cleaner than
setting PS1 on every host; that would be nice.

Thanks,

Mike

------------------------------------------------------------------------------
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand 
malware threats, the impact they can have on your business, and how you 
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users

Reply via email to