Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 19 Aug 2004 11:38:28 +0930
From:      Greg 'groggy' Lehey <grog@FreeBSD.org>
To:        Duane Winner <duanewinner@att.net>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: xtset or xtermset tricks?
Message-ID:  <20040819020828.GJ81574@wantadilla.lemis.com>
In-Reply-To: <41222679.7080000@att.net>
References:  <41222679.7080000@att.net>

next in thread | previous in thread | raw e-mail | index | archive | help

--4vpci17Ql0Nrbul2
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

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@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@FreeBSD.org for PGP public key.
See complete headers for address and phone numbers.

--4vpci17Ql0Nrbul2
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.0 (FreeBSD)

iD8DBQFBJAucIubykFB6QiMRAj8TAKCL7EV3kIg3jvHTWCKpr5g6v5S65gCeNz4f
5tNpdg2+jg87R3KejEY7xw8=
=FMS0
-----END PGP SIGNATURE-----

--4vpci17Ql0Nrbul2--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040819020828.GJ81574>