Blog | Admin | Archives | Heatmap | Recent | Random | Plan
    • The City
    • The less-well-known Brandenburg Gate in Potsdam.
    • First triathlon in 8 years! 
#blenheimtriathlon 2017
    • Motown!

Patching PuttyCyg to Send Ctrl-Tabs

Recently, I started using Windows 7 on my laptop, which lead me to adopting PuTTYcyg as my terminal of choice. Also, in large part due to my new job at Facebook and my misgivings about some aspects of Mac OS X, I’ve been experimenting with my terminal setup a lot recently. My research during this time led me to learning about patching PuTTY to send ctrl-tab and ctrl-shift-tab. I thought that sounded like a good idea, but of course I was using PuTTYcyg now, so I had to do the patching myself.

It turned out that downloading and patching the code was straightforward enough: With a few development packages in cygwin (namely make and the normal C/C++ gcc), make worked (almost) without a hitch. All I had to do was download the PuTTYcyg icon (which was not included in the patch), and everything compiled properly. However, after compiling, when I ran a cygwin terminal, a second windows command-prompt-style window with a bunch of debug info popped up:

PuTTYcyg Issue

This of course was a non-starter, so I searched in vain for a few hours to try to fix this, and ended the night by opening a new issue at the PuTTYcyg home page.

The PuTTYcyg developer pointed me to the Makefile used to build the PuTTYcyg releases. In it are a few special XFLAGS that magically make the extra window not appear:

XFLAGS= -UDEBUG -UNO_MULTIMON

Using the new Makefile, I compiled again, and this time when I ran PuTTYcyg, there was no annoying extra window. Brilliant!

Feel free to contact me if you need any more info.

Windows 7 Initial Impressions

Dan gave me a copy of Windows 7 to try out. Since I was having trouble with my installation of Windows XP, it didn’t take much to motivate me to try out the new, widely heralded Operating System from Microsoft.

Installation was easy and fast, just like I had heard. The UI is very responsive and looks nice (although I haven’t yet figured out how to make the window borders slightly thinner — advice would be welcome). The OS overall feels well-done and new, yet familiar enough that I don’t feel lost in a foreign world.

I set about installing a bunch of my most important apps — first Firefox, IrfanView, and Cygwin. This is when I ran into the first major problem that I have with Windows 7. In my previous version of XP, I had achieved what I considered the perfect blend of Windows and Linux functionality: cygwin running an ssh server that I accessed via PuTTY, just as I would access any remote server, such as nexus, attu, or frankenputen.

The coup de grace was the fact that I could launch Windows GUI programs from the ssh process — normally not achievable, but when the sshd service is allowed to “interact with the desktop”, then wonderful things such as KDiff3 working seamlessly with mercurial is possible on Windows. It was basically a perfect development setup for me.

I planned on setting up the same thing with Windows 7, and by following a tutorial about setting up the Cygwin SSHd service on Windows Server 2003, I was able to get almost all the way there. However, there is one key difference between XP and Windows 7: For security reasons, the System User is not allowed to setuid, which means that the Cygwin SSH server can not run as System anymore. There is an easy workaround for this — just set up a new privileged user, and run sshd under those credentials. However, it turns out that only the system user has an option to allow services to interact with the desktop.

This means that the perfect setup I had achieved earlier is effectively impossible on Windows 7. I’m pretty sure that this is an edge case that Microsoft has no plans on doing anything about in the near-term because it will affect almost no one. So the question then becomes, what does Windows 7 give me that Windows XP did not?

This machine has 4GB of RAM, but even if I can only access 3.5 under XP, that was good enough for everything I was doing. I think I’ll give Windows 7 another day, and unless I find a compelling reason to keep it, I’ll just do a fresh install of XP, which probably would have fixed the blank screen problem anyway.

At any rate, there are a few other things that I really like about Windows 7: The text box in the start menu is genius. It does exactly what it should, as far as I can tell. The UI really is pretty. The Wireless connection tools are much better than XP. It is a good OS, but I’m not sure it is so much better than XP that it will compell me to stick with it.

Instant Update!!

While writing this post, I remembered seeing something called PuttyCyg, which allows one to use putty as the front-end of Cygwin, which was the main thing I was trying to do anyway; this may be the solution to all of my problems.