xtset or xtermset tricks?

Greg 'groggy' Lehey grog at FreeBSD.org
Wed Aug 18 19:08:34 PDT 2004


On Tuesday, 17 August 2004 at 11:38:33 -0400, Duane Winner wrote:
> Hello,
>
> Hey, does anybody know of any useful tricks for automating xtset or
> xtermset?
>
> I use xtset to set the title and icon labels to user at host:path so I can
> keep track of my xterms littered all over my desktop (pretty frequent! :)
>
> But it sure would be nice to have them updated whenever I 'cd' to
> another directory or 'su' to another user or 'ssh' to another host!
>
> I'm sure there's got to be someway to make this a little more seamless
> then running # xtset %u@%h:`pwd` everytime, but I'm just not good enough
> with shell programming to know how to do this.
>
> The closest I came was writing a small bash script that does:
>
>    for filename in /dev/ttyp*; do
>       /usr/local/bin/xtset %u@%h:`pwd` > "$filename"
>    done

Here's what I do (in .bashrc):

ssh ()
{
  xtset -t $*
  xtset -i "%u@%h:%D"
  command ssh $*
  xtset -t "%u (%T) %h:%D"
  xtset -i "%u@%h:%D"
}
cd ()
{
  command cd $*
  if [ $? = 0 ]; then
    xtset -t "%u (%T) %h:%D"
    xtset -i "%u@%h:%D"
    true
  else
    false
  fi
}

  xtset -t "%u (%T) %h:%D"
  xtset -i "%u@%h:%D"

The last two lines set the initial heading.

Note also that you can set headings from another window: xtset writes
to its stdout, so this will do what you expect:

  xtset "Foo bah baz" >/dev/ttyp5

Greg
--
When replying to this message, please copy the original recipients.
If you don't, I may ignore the reply or reply to the original recipients.
For more information, see http://www.lemis.com/questions.html
Note: I discard all HTML mail unseen.
Finger grog at FreeBSD.org for PGP public key.
See complete headers for address and phone numbers.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20040819/35f7d7e7/attachment.bin


More information about the freebsd-questions mailing list