how to change the windows and menu keys under X (and Xorg)

this is handy for mapping the keys on the right side of the space bar to work like those on the left side.

list the keys:

gwox ~ $ xmodmap -pke | egrep 'Menu|Power|Super_|Alt_'
keycode  64 = Alt_L Meta_L Alt_L Meta_L
keycode 113 = Alt_L NoSymbol Alt_L
keycode 115 = Super_L NoSymbol Super_L
keycode 116 = Super_L NoSymbol Super_L
keycode 117 = Menu NoSymbol Menu
keycode 124 = Super_L NoSymbol Super_L
keycode 125 = NoSymbol Alt_L NoSymbol Alt_L
keycode 127 = NoSymbol Super_L NoSymbol Super_L
keycode 135 = Super_L NoSymbol Super_L
keycode 147 = Super_L NoSymbol Super_L
keycode 222 = XF86PowerOff NoSymbol XF86PowerOff

remap the keys

this is broken - it works, but i get errors. (sigh) i’ve been too busy to fix it.

$HOME/bin/remapctlkeys
#!/bin/sh
xmodmap -e 'keysym Alt_R = Alt_L'
xmodmap -pke | grep Super_R >/dev/null && xmodmap -e 'keysym Super_R = Super_L'
# this number will vary between systems; e.g., i've seen 147 this morning...
xmodmap -pke | grep Menu >/dev/null && xmodmap -e 'keycode 117 = Super_L'