Emacs over rdesktop

April 16, 2009

Finally solved an issue has been driving me crazy for weeks! If I can help one other poor soul out there with this writeup, it’ll be worth it. Even if not, I need this entry to make sure I never forget how to fix this problem.

At work, I’m running Ubuntu 8.10 on my workstation. I also have an XP VM running most of the time, so when I need to do Windows work, I can just RDP into it.

I’m using rdesktop as my RDP client, and it is working great, mostly. Very lightweight and fast. So when running it in fullscreen mode, the user experience is pretty much as if I had XP running locally.

Except…there was one small but extraordinarily annoying issue.

Sometimes, after pressing the left Alt and Shift keys simultaneously, the keyboard would get into some state where it acted as if the left Windows key was depressed. The effect was that subsequent keypresses would pop up windows with dogs in them (“f”), Explorer windows (“e”) or similar. It would stay this way until I actually pressed the Windows key to somehow reset it.

It turns out that when the Alt key is depressed before the Shift key, an ALT_L window event (or whatever it’s called, I don’t even want to know) is generated for the Alt key.

But when the Shift key is depressed before the Alt key, a META_L event was generated instead!! How lame is that?!?

So this was what tripped rdesktop, and it was really a bitch to find. It seemed to pop up randomly, the randomness being caused by whichever key I happened to strike first…

Almost forgot to mention the trick I found to fix the issue. Simply put this in your .profile:

xmodmap -e "remove mod1 = Meta_L"

This causes the left Alt key to always generate an ALT_L event. Problem solved.

UPDATE:
Seems the above method didn’t quite cut it… I also needed to add this to “.profile”:

xmodmap -e "keycode 64 = Alt_L"

For some reason, I think this has become necessary since upgrading to 9.04…?

Follow

Get every new post delivered to your Inbox.