Re: Changing xterm titles to something more usefull than 'xterm'

1998-04-21 Thread Mike Brownlow
 this one has a color prompt.. :)

heh. cewl. I'm using yours now. :) I noticed mine was really dumb
because it executes all of those programs every time a new prompt
is issued. I guess the first two should have been pointed toward
env variables. Still, I like yours better. :)

As for the current command executing, maybe for specific commands you'd
like to see in the titlebar, you could wrap them with a shell of some
sort. Then the sub-shell would update the title before executing the
command.

So...

docmd.sh:
#!/bin/sh
echo -n ^[]2;[EMAIL PROTECTED]
exec $@

Then alias the commands you want like:
alias find=docmd.sh find

Then run something like:
find / -name *.cxx -print

This worked for me anyway.

BTW, thanks for that prompt! :)

-mike


--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]


RE: Changing xterm titles to something more usefull than 'xterm'

1998-04-20 Thread Mike Brownlow
On 20-Apr-98 Norbert Veber wrote:
 Is there a simple way to make xterms display the current command
 beeing executed in the window? By simple I mean without patching and
 recompiling bash and/or xterm. I know that you can change the title
 using the -T command line option, but I want it to change dynamically
 depending on what I'm doing in that xterm. This would work nicelly
 with afterstep's window list module.  
 
 To make it display the current path, something like this can be used 
 (in bash):
 PS1='([EMAIL PROTECTED]:\w)% \[\033]0;\w\007\]'
 
 But how can I make it display the name of the command?
 

Changing the title bar dynamically can be done with the PROMPT_COMMAND
environment variable (in bash). In my bashrc I have:

function settitle
{
#  title=[EMAIL PROTECTED]:(`date +%k:%M:%S`):`pwd`
  title=[EMAIL PROTECTED]:(`date +%k:%M:%S`):`history 1`
  echo -n ^[]2;$title^G  /dev/tty
}

if [ $TERM = xterm ] || [ $TERM = xterm-color ]; then
PROMPT_COMMAND=settitle
PS1='\h:\u  '
fi

The first title assignment is useful when I want to know the current
directory while having a small prompt. Also for telling when an xterm
was last used.

The second one only lists the last command executed. Don't know how to
list the current one.

Hope this helps!

(thanks go to Glynn Clements on linux-admin for this tid-bit)

Mike Brownlow [EMAIL PROTECTED]


--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]


Re: Changing xterm titles to something more usefull than 'xterm'

1998-04-20 Thread Norbert Veber
 Changing the title bar dynamically can be done with the PROMPT_COMMAND
 environment variable (in bash). In my bashrc I have:
 
 function settitle
 {
 #  title=[EMAIL PROTECTED]:(`date +%k:%M:%S`):`pwd`
   title=[EMAIL PROTECTED]:(`date +%k:%M:%S`):`history 1`
   echo -n ^[]2;$title^G  /dev/tty
 }
 
 if [ $TERM = xterm ] || [ $TERM = xterm-color ]; then
 PROMPT_COMMAND=settitle
 PS1='\h:\u  '
 fi

that would work too, but I think its a bit too complicated, I use this now:
HBLK='[[1;30m'
HBLU='[[1;34m'
BLU='[[0;34m'
YEL='[[0;33m'
WHT='[[0;37m'
NORM='[[1;0m'

case $TERM in
  xterm)
export
PS1='[EMAIL PROTECTED]
\[\033]0;[EMAIL PROTECTED] \w\007\]'
  ;;
  *)
export
PS1='[EMAIL PROTECTED]
\]\[$NORM\]\[$YEL\][\[$WHT\]\w\[$YEL\]]\[$NORM\]\$ '
  ;;
esac

this one has a color prompt.. :)

 
 The second one only lists the last command executed. Don't know how to
 list the current one.

ah, I don't see any way of doing it..


pgpIM4IHBiJFH.pgp
Description: PGP signature