I was just learning for an exam (and taking glimpses at irssi) when a thought hit me: “wouldn’t it be nice if Terminator showed the currently running command in the window’s title”.

So, I asked Google and found a pretty nice post on how to do it. At first the proposed solution resulted in some weird messages being printed, but just changing the order of a line fixed it, so here’s the working code for bash in Ubuntu Intrepid:

if [ "$SHELL" = '/bin/bash' ] then case$TERM in

rxvt|*term)

set -o functrace

export PS1="\e]0;$TERM\007$PS1"

trap 'echo -ne "\e]0;\$BASH_COMMAND\007"' DEBUG

;;

esac

fi

Pretty nice, eh? Now, if someone’s up for a challenge: if it showed the command being executed inside screens instead of just “screen -r” that would be even greater.

Edit: And if someone knows how to get WordPress to display the messages properly that would rock.

Edit 2: I’ve just noticed that this breaks tab completion, so it’s not that nice after all.