[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Screen title, not just $WINDOW number, in prompt?
From: |
Steven Brown |
Subject: |
Re: Screen title, not just $WINDOW number, in prompt? |
Date: |
Thu, 01 Sep 2005 15:08:47 -0700 |
User-agent: |
Mozilla Thunderbird 1.0 (Windows/20041206) |
Thomas Köhler wrote:
> I'm not sure I understand your request (how do you set $WINDOW?),
I just include $WINDOW (which is defined in the environment by screen)
in bash's PS1 (prompt) variable. E.g.,
if test x"$WINDOW" != x""; then
SCREEEN_PS1="($WINDOW)"
else
SCREEEN_PS1=""
fi
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;address@hidden:\[\033[01;34m\]\w\[\033[00m\]${SCREEEN_PS1}\$
'
This results in the prompt looking like (for screen window 1):
address@hidden:~(1)$
What I want to do is instead of it showing the number of the screen, to
have it show the title I've assigned that window via C-a A. All I need
in order to do this is to know how to access that information from
screen given the $WINDOW number (I can use bash's $PROMPT_COMMAND to set
PS1 dynamically). E.g.,:
address@hidden:~(compile)$
> but maybe you just want to
> echo -e -n '\033khello world\033\\'
> (or put an escape, then k, then your title, then escape and a
> backslash into your prompt).
>
> While my .zshrc is set up to echo "zsh (tty-number)" in the
> prompt, it also does this fine precmd (which is executed directly
> before the current line gets executed):
>
> TTYSTRING=$(tty|sed -e 's,/dev/,,' -e 's/tty//')
> export TTYSTRING
>
> function preexec {
> if [ "$TERM" = "screen" ] ; then
> local y
> y=(${(s: :)1})
> echo -e -n "\033k$y[1] ($TTYSTRING)\033\\"
> fi
> }
I played around with this but couldn't seem to get it to react - is this
for setting the title in an xterm?
- Re: Screen title, not just $WINDOW number, in prompt?,
Steven Brown <=