The Microsoft Natural Ergonomic Keyboard 4000 that I use at work has this lovely extra backspace button that I always seem to hit by mistake against the bottom side of the desk when using the keyboard on my lap, which I do often.
I never thought much of this until one day I almost deleted a table in my dev
database (luckily it was on dev and luckily SQLyog asked for confirmation first)
This raised a red flag, I knew something had to be done. “Ah”, I thought, “I’ll
just use xmodmap
to remap the extra backspace key to do nothing.” Here are the
steps I took:
- Load up
xev
from the terminal. xev (x-event) is a tool which will help you capture all x events. - Press the desired key
-
Grab the keycode section of the output from the terminal. For example, pressing the ‘a’ key yields the keycode 38:
KeyRelease event, serial 35, synthetic NO, window 0x7200001, root 0x27a, subw 0x0, time 607631713, (-736,656), root:(702,705), state 0x10, keycode >>> 38 <<< (keysym 0x61, a), same_screen YES, XLookupString gives 1 bytes: (61) "a" XFilterEvent returns: False
- In the case of my extra backspace, the keycode resolved to 22
-
Use
xmodmap
to unassign the key. I believe there is actually aremove
directive, but since I don’t know exactly how to use it I just assign it to nothing:xmodmap -e 'keycode 22 = '
- Now try using the key you disabled!
Awesome! My extra backspace key stopped working. I tested it on the other machine as well through synergy just to make sure and all was well there, too!
##But wait, there’s more! I went back to work and soon I discovered my mistake. Keycode 22 is the same keycode that the normal backspace key produces. I cursed out Microsoft but only until I came up with a reliable, more cross-platform solution
blog comments powered by Disqus