Friday, April 19, 2013

Remapping a Control key to Windows / Super Under Ubuntu 12.04

My old ThinkPad keyboard rocks: it has a trackpad and a trackpointer, types nicely, has a palm rest, and is generally awesome. It does not, however, have a Windows button: this makes using it under... well, anything... difficult.

I'm currently developing with a company-bought Ubuntu laptop after having used OS X for the last three years almost exclusively. Like Windows and OS X, it pretty much demands the use of a Super key for accessing OS functionality and popping up utilities and applications.

I used two tools to do the remapping, xev and xmodmap. The lower-left control key is key code 0x25 (37). Ultimately it ended up being simple, and my .Xmodmap looks like this:

clear Control
keycode 37 = Super_L
add Control = Control_L Control_R

I also added the following to my .xinitrc, but it may be redundant:

xmodmap .Xmodmap

It's more awkward than a proper Super key, but it's workable, and I'm typing happier.