From 0bea92654c016021b85db0873f059221329c8f3b Mon Sep 17 00:00:00 2001 From: "R. Steve McKown" Date: Fri, 16 May 2014 17:37:20 -0600 Subject: [PATCH] swapkeys blog entry --- in/blog/2014-03.md | 5 ++++ in/blog/swapkeys.md | 64 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+) create mode 100644 in/blog/2014-03.md create mode 100644 in/blog/swapkeys.md diff --git a/in/blog/2014-03.md b/in/blog/2014-03.md new file mode 100644 index 0000000..0696b61 --- /dev/null +++ b/in/blog/2014-03.md @@ -0,0 +1,5 @@ +title: 2014-03 blogs +linktitle: 2014-03 +parent: 2014 +ctime: 2014-03-01 +mtime: 2000-01-01 diff --git a/in/blog/swapkeys.md b/in/blog/swapkeys.md new file mode 100644 index 0000000..3a812e0 --- /dev/null +++ b/in/blog/swapkeys.md @@ -0,0 +1,64 @@ +title: Swapping Control and Super Keys +linktitle: swapkeys +parent: 2014-03 +ctime: 2014-03-22 +mtime: 2014-03-22 + +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" + -- 2.39.2