[Thread Prev][Thread Next]   >Date Index >Thread Index

Re: [wmx] Tab idea...

Jason Smith - Thu Jun 22 19:49:02 2000


I have to actually type the titlebar that way ;)

On Thu, 22 Jun 2000, Mark Johnson wrote:

> How about something like:
> 
> 	# bash/ksh
> 	function telnet {
> 		# set xterm title bar based on args to function...
> 		/usr/bin/telnet $*
> 	}
> 
> Substitute rsh/ssh/etc as needed.
> 
> n Thu, Jun 22, 2000 at 10:14:59AM -0400, Jason Smith wrote:
> > 
> > 
> > I work for an ISP, and unfortunately allowing all admins to create their
> > own startup scripts on all new customer machines is not an option. This
> > was the most elegant solution I could come up with outside of an expect
> > script (which wasn't too practical).
> > 
> > On Wed, 21 Jun 2000, An Thi-Nguyen Le wrote:
> > 
> > > 
> > > 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:
> > > 
> > >    chpwd() {
> > >      [[ -t 1 ]] || return
> > >      case $TERM in
> > >    	 *xterm*|screen|rxvt|(dk|k|E|a)term) print -Pn "\e]2;%n@%m:%~\a"
> > >    	 ;;
> > >      esac
> > >    }
> > > 
> > > 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:
> > > 
> > >    PS1="\h|\W> "
> > >    case $TERM in
> > >    	xterm*)
> > >    		PS1="\[\033]0;\u@\h: \w\007\]$PS1"
> > >    		;;
> > >    esac
> > >    
> > >    export PS1 
> > > 
> > > (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.  :)
> > > 
> > > 
> > > 
> > 
> 
> 



Next: