Many thanks. I feel stupid now, because as soon as I woke up and went to follow your advice I find that my .bashrc already contains (inherited from my distro, I think, or bash itself):
# Change the window title of X terminals case $TERM in xterm*|rxvt|eterm) PROMPT_COMMAND='echo -ne "\033]0;${us...@${hostname%%.*}:${PWD/$HOME/~}\007"' ;; screen) PROMPT_COMMAND='echo -ne "\033_${us...@${hostname%%.*}:${PWD/$HOME/~}\033\\"' ;; esac I just added the PS1 change in after the PROMPT_COMMAND for screen terms. And it works great. If anyone sees a problem with that, as opposed to `if [[ "$TMUX" ]] ; then ... ; fi` I'd be grateful for your advice. What I'm actually trying to achieve is to change the window title, so that tmux can show the current working directory in the status bar. I don't like using PROMPT_COMMAND so much because $PWD produces the ugly "/home/stroller", instead of the desired "~". Thus: PS1="\! \W "'\$ ' case $TERM in screen) PS1="\[\033]0;\w\007\]$PS1" ;; esac The '/W' in my prompt only shows me the basename of the directory I'm in and that ensures that, if I'm in some obscure long-named directory - such as /mnt/media/video/BBC/iPlayer/movies/ - then my prompt is short. I'm don't have to type over at the right-hand side of the screen, and overflowing onto a second line, even on the shortest of commands. ~ $ cd /mnt/media/video/BBC/iPlayer/movies/ movies $ By getting PS1 to change the window title I can get tmux's status bar to show the full path, '\w' so I can thus distinguish between the aforementioned directory and, say, ~/movies or /tmp/dvdripping/movies. I kinda feel like I'm pretty smart having figured this out, and so thus I'm kinda expecting to trip over myself having done it. The ideal thing for me next would be for the status bar to show "..." or some other indicator when the contents of status-left exceed its length. I don't see any obvious way to do this. I have `set -g status-left-length 20` right now, and by a coincidence "/mnt/media/video/BBC/" is 20 characters; my prompt shows "movies" and there's no way to distinguish between "/mnt/media/video/BBC/iPlayer/movies/" and the (theoretical) directory "/mnt/media/video/BBC/movies/". That's fine, but I would prefer the status bar would acknowledge that it's cutting off part of what it's being asked to show - the window title is set to "/mnt/media/video/BBC/iPlayer/movies/", the status bar should show "/mnt/media/video/B..." instead of "/mnt/media/video/BBC". I hope this all makes sense, and I appreciate your help already, Stroller. On 28 Oct 2010, at 10:16, Nicholas Marriott wrote: > Check for $TMUX in .profile or .bashrc or whatever and use it to set a > different prompt. > > > On Thu, Oct 28, 2010 at 10:05:30AM +0100, Stroller wrote: >> Hi there, >> >> I'd like to have a different Bash prompt within tmux from my normal one. >> >> Is this possible, please? >> >> I apologise if this is a dumb question, but I seem to have spent hours >> customising the status line, and this is the one last thing I don't seem to >> be able to get. >> >> I tried `set -g update-environment PS1=$` in my .tmux.conf, but I think I'm >> barking up the wrong tree with that one. >> >> Thanks in advance for any pointers, >> >> Stroller. ------------------------------------------------------------------------------ Nokia and AT&T present the 2010 Calling All Innovators-North America contest Create new apps & games for the Nokia N8 for consumers in U.S. and Canada $10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store http://p.sf.net/sfu/nokia-dev2dev _______________________________________________ tmux-users mailing list tmux-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/tmux-users