You are not logged in.

#1 2012-06-28 11:09:23

graph
Member
Registered: 2010-12-21
Posts: 105

[SOLVED] Set title in tmux/zsh

So, i'm trying to set the title to the currently running program in tmux AND restore the title to "zsh" when the program terminates.
So far I have this:

~/.zshrc

case $TERM in
	screen*)
		preexec(){
			printf '\033k'$(echo $1 | cut -d" " -f1)'\033\\'
		}
		;;
esac

This sets the title of the "tab" correctly. However, it's not resetting the title to "zsh", when the program finishes.
How do I accomplish this?

I've seen some mentioning of a postexec-function, but I can't really figure out where to place it.

Does anyone have any ideas how to make this work?

Last edited by graph (2012-06-28 19:28:52)

Offline

#2 2012-06-28 12:20:55

Mr.Elendig
#archlinux@freenode channel op
From: The intertubes
Registered: 2004-11-07
Posts: 4,097

Re: [SOLVED] Set title in tmux/zsh

Not exactly what you ask for, but my config sets the title to the current path, and do get reset after a command exits. See link in signature for the config.


Evil #archlinux@libera.chat channel op and general support dude.
. files on github, Screenshots, Random pics and the rest

Offline

#3 2012-06-28 15:23:21

graph
Member
Registered: 2010-12-21
Posts: 105

Re: [SOLVED] Set title in tmux/zsh

I got it working now, by studying you .zshrc, Mr.Elendig (norwegian?).

~/.zshrc

case $TERM in
	screen*)
		precmd(){
			# Restore tmux-title to 'zsh'
			printf "\033kzsh\033\\"
			# Restore urxvt-title to 'zsh'
			print -Pn "\e]2;zsh:%~\a"
		}
		preexec(){
			# set tmux-title to running program
			printf "\033k$(echo "$1" | cut -d" " -f1)\033\\"
			# set urxvt-title to running program
			print -Pn "\e]2;zsh:$(echo "$1" | cut -d" " -f1)\a"
                }
                ;;
esac

Last edited by graph (2012-06-28 19:31:23)

Offline

Board footer

Powered by FluxBB