From owner-freebsd-questions@FreeBSD.ORG Wed Aug 18 09:28:51 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 DB48E16A4CE for ; Wed, 18 Aug 2004 09:28:51 +0000 (GMT) Received: from mailgate.teledome.gr (mailgate.teledome.gr [213.142.128.12]) by mx1.FreeBSD.org (Postfix) with ESMTP id B3EEC43D48 for ; Wed, 18 Aug 2004 09:28:50 +0000 (GMT) (envelope-from nvass@teledome.gr) Received: from [192.168.1.71] (helo=iris.teledomenet.gr) by mailgate.teledome.gr with esmtp (Exim 4.34) id 1BxMwn-0004Zk-3B; Wed, 18 Aug 2004 12:41:33 +0300 From: Nikos Vassiliadis To: Duane Winner , freebsd-questions@freebsd.org Date: Wed, 18 Aug 2004 12:28:16 +0300 User-Agent: KMail/1.5.4 References: <41222679.7080000@att.net> <4122351E.7040205@att.net> <41223C19.1050800@att.net> In-Reply-To: <41223C19.1050800@att.net> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200408181228.16847.nvass@teledome.gr> 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: Wed, 18 Aug 2004 09:28:52 -0000 Since you use bash, you can use the variable PROMPT_COMMAND to execute something, just before the shell prints out PS1. And then you can set the xterm's title using something like this: echo -ne "\033]0;my xterm\007" Cheers, NikV On Tuesday 17 August 2004 20:10, Duane Winner wrote: > This is a little better: > > cd () > { > # do the actual cd > builtin cd "$@" > > # if in homedir, then make path '~', not full path > if [ $PWD == $HOME ]; then > XTDIR="~" > else > XTDIR="$PWD" > fi > > # set xtset title and icon to user@host:path > /usr/local/bin/xtset %u@%h:`echo $XTDIR` > } > > # force an xtset title at shell login: > cd > > > -Duane > > Duane Winner wrote: > > Found a solution! > > > > In ~/.bashrc, put this: > > > > cd () > > { > > builtin cd "$@" > > /usr/local/bin/xtset %u@%h:`pwd` > > } > > > > > > > > -Duane > > > > 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 > >> > >> And thought about cron'ing it (every minute), but the problem is that > >> when I tested this, all my xterms get the same title/icon based on who > >> is running the script and where at the time. No good :( > >> (And of course this would be useless to update the titles/icons for > >> xterms that are remote shells (ssh). > >> > >> > >> Any thoughts? > >> > >> Thanks! > >> Duane > >> _______________________________________________ > >> freebsd-questions@freebsd.org mailing list > >> http://lists.freebsd.org/mailman/listinfo/freebsd-questions > >> To unsubscribe, send any mail to > >> "freebsd-questions-unsubscribe@freebsd.org" > > _______________________________________________ > freebsd-questions@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to > "freebsd-questions-unsubscribe@freebsd.org"