From owner-freebsd-questions@FreeBSD.ORG Thu Aug 19 02:08:33 2004 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D38F116A4CF for ; Thu, 19 Aug 2004 02:08:33 +0000 (GMT) Received: from ozlabs.org (ozlabs.org [203.10.76.45]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2509A43D3F for ; Thu, 19 Aug 2004 02:08:33 +0000 (GMT) (envelope-from grog@lemis.com) Received: from blackwater.lemis.com (blackwater.lemis.com [192.109.197.80]) by ozlabs.org (Postfix) with ESMTP id E16DC2BD9F for ; Thu, 19 Aug 2004 12:08:30 +1000 (EST) Received: by blackwater.lemis.com (Postfix, from userid 1004) id C5F4A51202; Thu, 19 Aug 2004 11:38:28 +0930 (CST) Date: Thu, 19 Aug 2004 11:38:28 +0930 From: Greg 'groggy' Lehey To: Duane Winner Message-ID: <20040819020828.GJ81574@wantadilla.lemis.com> References: <41222679.7080000@att.net> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="4vpci17Ql0Nrbul2" Content-Disposition: inline In-Reply-To: <41222679.7080000@att.net> User-Agent: Mutt/1.4.1i Organization: The FreeBSD Project Phone: +61-8-8388-8286 Fax: +61-8-8388-8725 Mobile: +61-418-838-708 WWW-Home-Page: http://www.FreeBSD.org/ X-PGP-Fingerprint: 9A1B 8202 BCCE B846 F92F 09AC 22E6 F290 507A 4223 cc: freebsd-questions@freebsd.org Subject: Re: xtset or xtermset tricks? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Aug 2004 02:08:34 -0000 --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--