[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bag o' Questions



On Sat, May 06, 2000 at 12:19:25AM -0400,
Patrick Dahiroc <patd@dahiroc.net> wrote:

> 1) I'm running gnome-terminal as my xterm. The title on the
> window simply says 'Terminal'. Is possible to have the window
> title dynamically change to the current working directory. Kinda
> like the way emacs changes the window title to the name of the
> current file.

I have this in ~/.zshrc. Not sure how to do it in bash (why would
you use bash, anyway?).

settitle() {
    case $TERM in
    *xterm* | *rxvt* | (dt|k|E)term)
	print -Pn "\e]2;$*\a"
	;;
    esac
}

seticontitle() {
    case $TERM in
    *xterm* | *rxvt* | (dt|k|E)term)
	print -Pn "\e]1;$*\a"
	;;
    esac
}

precmd() {
	[[ -t 1 ]] || return	# return if not on a terminal

	settitle "%n@%m: %~"
	seticontitle "%n@%m: %~"
}

P.S. Please wrap lines at 65 columns.

-- 
Eric Gillespie, Jr. <*> epg@pobox.com

"Let us be thankful we have commerce. Buy more. Buy more now.
 Buy. And be happy."
--OMM (THX 1138)

Attachment: pgphP5UPSiDJF.pgp
Description: PGP signature


Reply to: