You are not logged in.

#1 2012-12-03 07:36:43

rzrscm
Member
Registered: 2012-11-17
Posts: 95

urxvt title

I want urxvt's titlebar to show the name of the current process it's running instead of 'urxvt' so that the task names can be more informative in my panel when I have everything minimized...Is this possible?

Offline

#2 2012-12-03 07:53:50

kaszak696
Member
Registered: 2009-05-26
Posts: 543

Re: urxvt title


'What can be asserted without evidence can also be dismissed without evidence.' - Christopher Hitchens
'There's no such thing as addiction, there's only things that you enjoy doing more than life.' - Doug Stanhope
GitHub Junkyard

Offline

#3 2012-12-03 10:25:35

rzrscm
Member
Registered: 2012-11-17
Posts: 95

Re: urxvt title

Thank you for that...So, I have this in my .zshrc now...

[[ -t 1 ]] || return
case $TERM in
	*xterm*|*rxvt*|(dt|k|E|a)term)
	preexec () {
		print -Pn "\e]2;[%l] $1\a"
		#print -Pn "\e]2;$1\a"
	}
	;;
	screen*)
		preexec () {
		print -Pn "\e\"$1\e\134"
	}
	;; 
esac

function precmd() {
	print -Pn "\e]2;[%l] %~\a"
}

It does exactly what I want it to do...When in a directory, it shows the directory I'm in, and when running a program it displays the program's name.  I'm wonder if there's a way to optimize the code so if I use a command like ls or cd it doesn't change it to the command name for a split second before changing it back to the directory name, maybe by making it wait a couple of seconds before changing the title display.  Completely cosmetic issue, but if I can fix it I'd like to.

Last edited by rzrscm (2012-12-03 10:57:21)

Offline

#4 2012-12-03 12:41:38

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,554
Website

Re: urxvt title

There's no way for the shell to know ahead of time how long a command will take.  So the only way to do what you want would be to launch two subshells every time you run any command *and* have a way to send data between them.  If this is possible at all, you would incur a large processing or resource use cost for a very small cosmetic benefit.

If there is an elegant solution, however, I'd be happy to be proven wrong - I'm just skeptical that such a search would turn up anything useful.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#5 2012-12-30 00:01:09

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: urxvt title

urxvt -e vim <somefile>

shows 'vim' in my dwm bar.
If I first launch urxvt (it will spawn a shell instance) and later launch e.g. vim, the bar will show 'urxvt'.

Offline

Board footer

Powered by FluxBB