] >Date Index
Re: [wmx] Tab idea...An Thi-Nguyen Le
- Thu Jun 22 00:37:22 2000
On Wed, Jun 21, 2000 at 03:22:51PM -0400, Jason Smith typed:
} Here's something I wrote to accomplish similar...
} I am always running 10 xterms at once, each on a different machine. I
} needed a way to change the titlebar without having to install a script or
} type a long line everytime. You add the program to your .wmx folder,
} select some text with the mouse, run it from the menu and choose a
} window. It will retitle the window to the current text selection..
Or better yet, just send the proper escape codes conditionally in your
shell startup files. For instance, using zshell, I put this in my .zshrc:
[[ -t 1 ]] || return
case $TERM in
*xterm*|screen|rxvt|(dk|k|E|a)term) print -Pn "\e]2;%n@%m:%~\a"
which sets the xterm title bar (if this is an xterm) to login@machine: pwd.
(Note that the title bar is set only on a change of directory; I put a
'cd .' at the end of my .zshrc.) Zsh is especially nice because it can
do truncation at the end of the directory; something like
print -Pn "\e]2;%n@%m:%(3~,../,)%2c\a"
(which is probably horribly inefficient) yields at most the last two
elements of the current directory path, replacing the prefix with '../'
in the xterm titlebar. Of course, you'll probably still get truncation
at the end...
If you're using bash, something like this will suffice:
case $TERM in
(or you can just set up PROMPT_COMMAND to point to an appropriate function;
this is a little kludgy but I picked it up from someone a whiles ago.)
You can do similar things for tcsh. Not that I remember what they were. :)
An Thi-Nguyen Le
|You have an unusual magnetic personality. Don't walk too close to
|metal objects which are not fastened down.