screen-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: window screen title in ssh connection


From: Brian Kroth
Subject: Re: window screen title in ssh connection
Date: Mon, 27 Apr 2009 09:25:59 -0500
User-agent: Mutt/1.5.18 (2008-05-17)

JuanPablo <address@hidden> 2009-04-25 19:37:
> hi,
>   for change the title of my windows screen in the ssh connections add
> in the file ~/.ssh/config
> host remoteHost
> user remoteUser
> port 22
> hostname remoteIp
> ForwardX11 yes
> LocalCommand echo -ne '\ekremoteHost\e\\'
> 
> now, the title of window connection is correct, ok
> 
> you know  how change the title when the connetion finish ?

I'm assuming you want it to change back automatically when you close the
ssh connection.  There's some documentation in "man screen" about
dynamic window titles that are based off of your shell prompt.  Search
for "TITLES".

If you're using bash, I've also had good luck with this script:
http://www.twistedmatrix.com/users/glyph/preexec.bash.txt

It emulates a feature in zsh called preexec, where you can configure a
command to run just before the shell execs your input.  This is
different from precmd (bash's PROMPT_COMMAND), which only executes just
before the shell prints the prompt (ie: after your input returns).

Then, include this in your .screenrc

        # Export a variable denoting the original host screen was started on.
        # This is used by the bash.preexec stuff:
        # http://glyf.livejournal.com/63106.html?thread=210818
        setenv SCREEN_RUN_HOST $SCREEN_HOST
        setenv SCREEN_RUN_USER $USER
        setenv LC_SCREEN_RUN_HOST $SCREEN_HOST
        setenv LC_SCREEN_RUN_USER $USER

The bash.preexec script can make use of these variables to change your
prompt based on the machine you're connected to and where the screen
session is running.  It also depends on "SendEnv LC_*" in your
.ssh/config and "AcceptEnv LC_*" in the remote sshd_config.  I think
Debian has that by default.  I've done much more fiddling with the
original to make it display how I like it, but the hard work has been
done for you already.

Brian




reply via email to

[Prev in Thread] Current Thread [Next in Thread]