|
From: | Leen Smit |
Subject: | Re: Dynamic Title |
Date: | Tue, 09 Jun 2009 09:55:41 +0200 |
User-agent: | Thunderbird 2.0.0.21 (X11/20090409) |
Brian Kroth wrote:
I have followed the advice Brian gave here, and I can set this up easily on my own system. Yet, when I start a terminal session, ssh to another host from where I start screen, this solution with preexec doesn't work.Asif Iqbal <address@hidden> 2009-06-02 17:47:On Tue, Jun 2, 2009 at 5:36 PM, Dan Mahoney, System Admin <address@hidden> wrote:On Tue, 2 Jun 2009, Asif Iqbal wrote:On Tue, Jun 2, 2009 at 5:07 PM, Dan Mahoney, System Admin <address@hidden> wrote:On Tue, 2 Jun 2009, Asif Iqbal wrote:On Tue, Jun 2, 2009 at 4:44 PM, Dan Mahoney, System Admin <address@hidden> wrote:On Tue, 2 Jun 2009, Asif Iqbal wrote:This is what I have done on the screen server to achieve dynamic title. in .bashrc : PROMPT_COMMAND='if [ $TERM = "screen" ]; then printf "\033k${HOSTNAME%%.*}\033\\" ; fi' in .ssh/config : # this won't work unless your screen server has openssh 5.1 or above host * PermitLocalCommand yes LocalCommand /path/to/screen_ssh.sh %n in screen_ssh.sh : # got the idea from http://www.tenshu.net/screen_ssh/Why would you tie this to your ssh command at all? I have a postcmd in my shell like this (this is tcsh): alias postcmd 'printf "\033%s%s %s %s\033\\" "k" "\!#:0" "\!#:$" "[$HOST]"'You need to create that alias on every hosts. I have 300 of them.Nope, just the one I ssh out from. I ssh into about as many hosts as you do, but only one or two "home" servers (where my keys live, etc). Better put, your shell only needs to be modified on machines you run "screen" on.with your setup when you ssh to a host it changes the title fine, but when exit from it the title does not change back.Yes, when I exit from it, it changes back because my prompt on my main machine is set thusly: set prompt="%{\ektsch [$HOST]\e\\%}"\%Ok it is more than just postcmd. Let me know if you can make it work for bash users. I dont use tcshThis is basically what you're looking for: http://www.twistedmatrix.com/users/glyph/preexec.bash.txt I posted a small example of how to use it with screen (and other long running commands) for window title changing in an earlier thread: http://lists.gnu.org/archive/html/screen-users/2009-04/msg00043.html There are ways around the LC_* "requirements" I posted earlier. Brian _______________________________________________ screen-users mailing list address@hidden http://lists.gnu.org/mailman/listinfo/screen-users I have copied my (working) .bashrc, .screenrc and preeexec.bash over to the remote system, so the files are identical, but as to why this wont work is eluding me. How can the fact that i come from a remote host, with the same setting, be in the way of sending the dynamic title? Can any one shed some light on this? Leen I have the following in my bashrc: . ./preeexec.bash set_xterm_title () { local title="$1" case "$TERM" in xterm*|rxvt*) echo -ne "\e]0;$title\007" ;; screen) echo -ne "\033k$title\033\\" ;; esac } precmd () { set_xterm_title "address@hidden `dirs -0` $PROMPTCHAR" } preexec () { set_xterm_title "address@hidden" } preexec_install And in my screenrc: setenv SCREEN_RUN_HOST $SCREEN_HOST setenv SCREEN_RUN_USER $USER setenv LC_SCREEN_RUN_HOST $SCREEN_HOST setenv LC_SCREEN_RUN_USER $USER |
[Prev in Thread] | Current Thread | [Next in Thread] |