Re: xterm title
Re: xterm title
- Subject: Re: xterm title
- From: robert delius royar <email@hidden>
- Date: Sat, 20 Nov 2004 17:47:53 -0500 (EST)
- Organization: An Apple OS X end user
- Priority: NEW
Sat, 20 Nov 2004 (13:19 -0800 UTC) Hugh McIntyre wrote:
>
> |> I noticed that once I log on a Linux box from an OS X X11 window, the
> |> title of the X11 window changes to username@machinename:
> |> working_directory.
> |>
> |> Is there a way to replace the "xterm" title of the X11 window to show
> |> the local working directory (in OS X)?
>
> Yes. Same way you do it in other versions of Unix and Linux. Put something
> like the followint in ~/.cshrc if using csh/tcsh, or equivalent syntax elsewhere
> for bash:
>
> if ($?prompt && $?TERM) then
> switch ($TERM)
> case xterm:
> alias Header 'printf "\033]2;'`whoami`@`hostname`' : $cwd\007\r"'
> alias IHeader 'printf "\033]1;.../$cwd:t\007\r"'
> alias cd 'cd \!*; Header ; IHeader'
> alias pushd 'pushd \!*; Header ; IHeader'
> alias popd 'popd \!*; Header ; IHeader'
> alias pwd 'dirs ; Header ; IHeader'
> alias su 'su \!*; Header ; IHeader'
> alias ssh 'ssh \!*; Header ; IHeader'
> alias rlogin 'rlogin \!*; Header ; IHeader'
> alias rsh 'rsh \!*; Header ; IHeader'
> alias newgrp 'newgrp \!*; Header ; IHeader'
> Header ; IHeader # initialize
> breaksw
> endsw
man tcsh
says
[...]
cwdcmd Runs after every change of working directory. For example,
if the user is working on an X window system using xterm(1)
and are-parenting window manager that supports title bars
such as twm(1) and does
> alias cwdcmd 'echo -n "^[]2;${HOST}:$cwd ^G"'
then the shell will change the title of the running xterm(1) to
be the name of the host, a colon, and the full current working
directory. A fancier way to do that is
> alias cwdcmd 'echo -n "^[]2;${HOST}:$cwd^G^[]1;${HOST}^G"'
This will put the hostname and working directory on the
title bar but only the hostname in the icon manager menu.
Note that putting a cd, pushd or popd in cwdcmd may cause an
infinite loop. It is the author's opinion that anyone doing so
will get what they deserve.
jobcmd Runs before each command gets executed, or when the command
changes state. This is similar to postcmd, but it does not
print builtins.
> alias jobcmd 'echo -n "^[]2\;\!#^G"'
then executing vi foo.c will put the command string in the
xterm title bar.
[...]
postcmd Runs before each command gets executed.
> alias postcmd 'echo -n "^[]2\;\!#^G"'
then executing vi foo.c will put the command string in
the xterm title bar.
[...]
--
rdr
_______________________________________________
Do not post admin requests to the list. They will be ignored.
X11-users mailing list (email@hidden)
This email sent to email@hidden