After marathon multi-hour code sessions, I will sometimes get wrist discomfort. I've learned that one of the key actions that trigger discomfort is [ulnar deviation] (http://www.exrx.net/WeightExercises/WristFlexors/DBUlnarFlexion.html). I've noticed that rotating my wrist in this fashion to reach the control keys with the pinkies repeatedly can really get my wrists fired up. Since I tend to live in the vim text editor, I tend to use this motion frequently!

To reach the control keys on most keyboards, one needs to move the entire arm and/or "ulnar deviate". But if the control keys are in the right position, one can use the "partial fist" method to depress them -- that is, roll up the pinky as if making a fist, and depress the key on the row with the space bar using the pinky's knuckle. This movement is accomplished with no arm movement and no ulnar deviation.

The problem with this partial fist method is that on most keyboards, one ends up hitting the windows key (on the left) and the menu key (on the right), and not the control keys. In Linux, these keys are referred to as the Super keys. So my solution to help alleviate some wrist pain is to re-map the keyboard to swap the Super and Control keys. I even pulled the keycaps off and moved them, for completeness (ensure your keyboard has removeable keycaps before trying this).

There are several ways to do this remapping, but the method I like the best is to change the keycodes assigned to the keys. The other method is to change the actions assigned to the keycodes, but I had various problems with this approach. Two simple script files, swapctrl and unswapctrl do the job.

#!/bin/bash
# Script to swap Control and Windows keys by reassinging keycodes

xmodmap -e "clear Control"
xmodmap -e "clear Mod4"
xmodmap -e "keycode 133 = Control_L NoSymbol Control_L"
xmodmap -e "keycode  37 = Super_L NoSymbol Super_L"
xmodmap -e "keycode 134 = Control_R NoSymbol Control_R"
xmodmap -e "keycode 105 = Super_R NoSymbol Super_R"
xmodmap -e "keycode 206 ="
xmodmap -e "add Control = Control_L Control_R"
xmodmap -e "add Mod4 = Super_L Super_R"

and

#!/bin/bash
# Script to unswap Control and Windows keys by reassinging keycodes

xmodmap -e "clear Control"
xmodmap -e "clear Mod4"
xmodmap -e "keycode  37 = Control_L NoSymbol Control_L"
xmodmap -e "keycode 133 = Super_L NoSymbol Super_L"
xmodmap -e "keycode 206 = NoSymbol Super_L NoSymbol Super_L"
xmodmap -e "keycode 105 = Control_R NoSymbol Control_R"
xmodmap -e "keycode 134 = Super_R NoSymbol Super_R"
xmodmap -e "add Control = Control_L Control_R"
xmodmap -e "add Mod4 = Super_L Super_R"