Mosh: Window title renaming

Created on 19 Nov 2013  路  4Comments  路  Source: mobile-shell/mosh

How should I go about renaming my window titles while in a mosh session, running from within tmux? I want my tmux window to have a title containing the remote hostname. It works with xterm (no tmux). This is how I set the window title on the remote side:

   if [[ "$TERM" == screen* ]]; then                                                                                                                                                                                             
     print -Pn "\ek:q\e\\" #set screen hardstatus, usually truncated at 20 chars                                                                                                                                               
   elif [[ "$TERM" == xterm* ]] || [[ $TERM == rxvt* ]] || [[ $TERM == ansi ]] || [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then                                                                                                     
     print -Pn "\e]2;:q\a" #set window name                                                                                                                                                                                    
     print -Pn "\e]1;:q\a" #set icon (=tab) name (will override window name on broken terminal)                                                                                                                                
   fi                                                                                                                                                                                                                            

Where $1 and $2 are strings, both containing PWD and hostname.

Most helpful comment

I'm not the original reporter, but I stumbled onto this years later via google.

The behavior seems different to me between mosh and ssh, yes. When I ssh into a host from tmux, my term is 'screen' and I can set title with \ektest\e\ and I'm good. When I mosh into a host from tmux, my term is 'xterm' and and none of these seem to propagate up to tmux: \ektest\e\ \e]0;test\g \e]2;test\g

The behavior is definitely different from ssh.

All 4 comments

Exactly the same way as if you were not using mosh. You need to turn on the tmux set-titles option.

Well no, I found that info. before and it doesn't work. Did you try using mosh yourself and got it to work?

You鈥檙e reporting a bug in the mosh bug tracker. Are you saying the problem is mosh-specific? Is the behavior any different with ssh instead of mosh?

This is not a tmux support forum, but in the interest of saving time, I鈥檒l suggest you note the difference between \ek and \e_ (in both screen vs. tmux).

If you think you need further help here, we need a test case where the same application behaves differently under mosh and under ssh.

I'm not the original reporter, but I stumbled onto this years later via google.

The behavior seems different to me between mosh and ssh, yes. When I ssh into a host from tmux, my term is 'screen' and I can set title with \ektest\e\ and I'm good. When I mosh into a host from tmux, my term is 'xterm' and and none of these seem to propagate up to tmux: \ektest\e\ \e]0;test\g \e]2;test\g

The behavior is definitely different from ssh.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

shibumi picture shibumi  路  5Comments

ghost picture ghost  路  5Comments

andschwa picture andschwa  路  4Comments

a-b picture a-b  路  6Comments

jiyinyiyong picture jiyinyiyong  路  7Comments