Re: addressable titlebars for Gnome-terminal?



> > this is especially handy to me as i have my titlebar show me which machine
> > i'm logged in on and who i'm logged in as.  if you're operating on a log
> > of machines, this is a very nice feature.
> 
> Can you tell us what is the escape sequence you use to do this?
> 
If you define function: 

 label () { echo -n "ESC]2;$*^G";}

then you just type:

 label any text you want in the title bar





Actuall	customization file(tbar.bash) is:

HSTNM=`uname -n | sed -e "s/\..*$//"`
SHNM=`echo $0 | sed "s/-//"`
if [ "$TERM" = "xterm" ] || [ "$TERM" = "xterm-color" ] && [ "$SHNM" = "bash" ];
 then
  ilabel () { echo -n "ESC]1;$*^G";}
  label () { echo -n "ESC]2;$*^G";}
  alias stripe='label $HSTNM - ${PWD#$HOME/}'
  alias stripe_vi='label $HSTNM - vi $*'
  alias stripe_less='label $HSTNM - less $*'
  alias stripe_run='label $HSTNM - $0 $*'
  cd_s () { "cd" "$*"; eval stripe;}
  vi_s () { eval stripe_vi; "vi" "$*"; eval stripe;}
  less_s () { eval stripe_less; "less" "$*"; eval stripe;}
  alias cd=cd_s
  alias vi=vi_s
  alias less=less_s
  eval stripe
  eval ilabel "$HSTNM"
fi

where ESC] is just an escape code and ^G is a code for Ctrl G.

For some reason

  echo $0 | sed "s/-//" 

gives /bash and not just bash. So s/-// should be replaced by
s/[-\/]//

 Sergey



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