Quick Linux Tip: Remap “Back” Key to Win Key

January 22, 2010

Thinkpad keyboards are the best laptop keyboards I’ve seen. The function keys are placed in groups of four, with gaps, like on a full-size keyboard. The arrow keys are located lower than the rest of the keys, for easy tactile identification. And best of all, the Insert, Delete, Home, End, and Page Up/Down keys are grouped in the familiar 2×3 box pattern one would expect to see on a desktop keyboard.

The only thing I’m missing is a right Windows key (technically a Super key). A lot of handy Amarok shortcuts use the Win key, such as Win+O for displaying the OSD, or Win+P for firing up the playlist. I’ve also set Win+Plus and Win+Minus to change the volume. With only a left Win key, all of the above-mentioned shortcuts require two hands. So what can I do?

I can remap the “back” key (XF86Back) located above the left arrow key to act as a right Win key. (The back key itself is not that useful — in most sensible applications, one can use Backspace for that purpose.)

First, I open up xev and press the key to find its keycode: 166. Then I use xmodmap to test the changes live:

xmodmap -e “keycode 166 = Super_R”

Finally, I save the setting in my ~/.Xmodmap:

keycode 166 = Super_R

Mission accomplished.

Shortcut: Delete an Entire Word

May 27, 2008

Before I began using VIM I didn’t care much that my typing habits were very inefficient, but now I’m looking everywhere for possible optimizations

There are two simple shortcuts that work on KDE, Gnome and (AFAIK) even Windows, and that will probably become second nature once you start using them. Perhaps they are regarded as common knowledge, but I’ve only stumbled across them this year.

Ctrl+Backspace deletes the last word.

Ctrl+Delete deletes the next word.

And of course Ctrl+W in bash (as in VIM) is very useful when the length of your command gets out of control.