Blog | Admin | Archives

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.

Useful Windows Device Manager Trick

Ever wanted to remove that driver for the hardware you no longer have installed? Well, with this information [techrepublic.com], now you can. Copied here for convenience:

Takeaway: Did you know that unless you uninstall a device driver on a Windows XP machine that it still may be sucking up valuable system resources? Here are step-by-step instructions on how you can view and remove these unnecessary devices.

When you install a device driver on a Windows XP machine, the operating system loads that driver each time the computer boots regardless of whether the device is present—unless you specifically uninstall the driver. This means that drivers from devices that you have long since removed from your system may be wasting valuable system resources.

Follow these steps to view and remove these unnecessary device drivers:

1. Press [Windows]+[Break] to bring up the System Properties dialog box.
2. Select the Advanced tab and click the Environment Variables button.
3. Click the New button below the System Variables panel.
4. In the New System Variable dialog box, type devmgr_show_nonpresent_devices in the Variable Name text box and 1 in the Variable Value text box.
5. Click OK to return to the System Properties dialog box and then click OK again.
6. Select the Hardware tab and click the Device Manager button.
7. In Device Manager, go to View | Show Hidden Devices.
8. Expand the various branches in the device tree and look for the washed out icons, which indicate unused device drivers.
9. To remove an unused device driver, right-click the icon and select Uninstall.

Useful Less Common Windows Tweaks

A better googler than I (namely, Dan of Carputer fame) forwarded these links to me, which I used to tweak my Windows XP + Installed Applications (because its really one big organic entity) to a better state. I hope they help someone else too.

This one isn’t too uncommon, but the info there gave me a much better understanding of where to look in the registry to accomplish what I wanted: Customize the right click context menus

More uncommon (and also very cool, imho): Edit the Places bar locations in Open/Save As boxes

Cheers!

Windows XP Woes

Occasionally, I will get on a stint to fix something on my computer that’s been bothering me. Today I decided that I just had to fix the fact that it takes me a long, long time to navigate though folders wit lots of images because Windows Explorer decides it needs to thumbnail all the images. Well, what seems like it should be an easy feature to turn off is anything but. After changing all sorts of normal and hidden options, messing with the registry, renaming system DLLs, and searching for hours on google, my system still goes to work to create all the thumbnails – even when it isn’t going to display them because I’m in detail or list view mode. It will contnue to drive me nuts when I’m opening a file in a folder with many large images (read: digicam download), taking minutes sometimes to get my system bak under control. Bah!

My brother was kind enough to run some tests on Mac OS X checking out the same functionality. OS X also creates thumbnails on local files, but it seems to do this truly in the background (XP’s takes over the system) and it doesn’t seem to try to do this over network connections (thank goodness). MS should start taking some ques from their Appletosh friends.