Okay, so despite the fact I’m a die-hard UNIX guy, I still spend the majority of my desktop time in Windows. I’m not ashamed of that, it just seems to be the way I’m most productive. However, I can’t stand Windows based IRC clients. I used mIRC for the longest time, but try as I might I just can’t use it any more – I have to use irssi.
I’m also a pig when it comes to my PC, I leave stuff laying around everywhere and it gets pretty tough. It’s nothing for me to have upwards of 20 or 30 PuTTY windows open at any one time, and even with a two-layer taskbar it’s pretty rough to keep them all organized. I tried for a bit having the taskbar on the side, but it really annoys me for some reason.
So anyway, one of the things I wanted to do was keep my irssi window in PuTTY having a separate title instead of just the hostname of the machine. That’s fine, PuTTY respects xterm title sequences, and there’s an irssi script that’ll send them.
The problems start when you try to throw screen into the mix. Screen likes to grab things like that (and bell characters) and do it’s own thing with it – sometimes it’s easy to tell it not to and other times it’s not. I googled around for a method to get the xterm title sequences to pass through screen, and wasn’t having much success. There’s even a wishlist item requesting it.
I found among some screen tips a way to exploit the hardstatus feature to make screen show xterm titles:
termcapinfo xterm\*|rxvt|gnome-terminal|konsole|kterm|Eterm 'hs:ts=\\E]0;:fs=\\007' defhstatus "screen \^E (\^Et) | \$USER@\^EH" hardstatus off
But it didn’t work. Finally, digging through the screen source code I managed to find an extra line:
termcapinfo xterm 'hs:ts=\\E]2;:fs=\\007:ds=\\E]2;screen\\007'
.. which made it work when I replaced the original termcapinfo line above with it. So this works on screen 4.x on FreeBSD 7.1:
termcapinfo xterm 'hs:ts=\\E]2;:fs=\\007:ds=\\E]2;screen\\007' defhstatus "screen \^E (\^Et) | \$USER@\^EH" hardstatus off
So far so good, it’s not dropping characters or any other weird stuff associated with playing with terminal escape sequences. Screen sets the title, then irssi immediately grabs it and I never have to see it again. I can detatch/re-attatch and everything works as it should.
I just can’t believe I wasted about 45 minutes experimenting with it, and digging through the screen source code when I didn’t have to.