Post-mortem update: After wrestling with xmodmap for the better part of the morning, I found this answer perfectly solves the issue. The reason, I believe, is that xmodmap is not as powerful as xkb, and xkb is closer to the keyboard hardware. After following these steps my KUL ES-87 with the Alt and Super keys switched and in "OS X Mode" is behaving like an Apple keyboard.
I just remapped some modifier keys with xmodmap using this script:
remove mod4 = Super_L
remove control = Control_L
add control = Super_L
add mod4 = Control_L
The Super key does work as Control (I can copy and paste using the Super key as it is mapped to the Control key). However, I cannot use the Control key (mapped to Super) for tasks Super is used for in Ubuntu like viewing the notification bar with Super+V or switching workspaces with Super+PgDn.
Oddly, when I go into Keyboard Shortcuts to remap these functions, it sees the keystrokes as I would expect. If I press Crtl+V on my keyboard, it records that I sent Super+V, yet trying to use this key combination in any other context outside of recording the shortcut in Keyboard Shortcuts still doesn't work. So, the Keyboard settings are correctly interpreting the modified key mapping, but they are still not working for their function. If I reset xmodmap Super and Control work as expected and all shortcuts work like they did out of the box.
What is the cause of this issue and how can I make my keyboard behave as expected?
Update: I reset xkb to default (which also reset xmodmap) and then updated xmodmap mappings using keycode. This had no effect except to disable the super key (this key no longer works to open the notification list, yet is still registering as the super key in Keyboard Shortcuts, and somehow the left Ctrl
key retains Control_L functionality (I can copy and paste from this key, and Keyboard Shortcuts still recognizes it as Control when assigning a new shortcut) What the heck is going on??
m@buntoo:~$ setxkbmap -layout us
m@buntoo:~$ xmodmap -pke | grep 'Super\|Control'
keycode 37 = Control_L NoSymbol Control_L
keycode 105 = Control_R NoSymbol Control_R
keycode 133 = Super_L NoSymbol Super_L
keycode 134 = Super_R NoSymbol Super_R
keycode 206 = NoSymbol Super_L NoSymbol Super_L
m@buntoo:~$ xmodmap -e "keycode 37 = Super_L"
m@buntoo:~$ xmodmap -e "keycode 133 = Control_L"
m@buntoo:~$ xmodmap -pke | grep 'Super\|Control'
keycode 37 = Super_L NoSymbol Super_L
keycode 105 = Control_R NoSymbol Control_R
keycode 133 = Control_L NoSymbol Control_L
keycode 134 = Super_R NoSymbol Super_R
keycode 206 = NoSymbol Super_L NoSymbol Super_L
m@buntoo:~$ xmodmap -e "keycode 206 = Control_L"
m@buntoo:~$ xmodmap -pke | grep 'Super\|Control'
keycode 37 = Super_L NoSymbol Super_L
keycode 105 = Control_R NoSymbol Control_R
keycode 133 = Control_L NoSymbol Control_L
keycode 134 = Super_R NoSymbol Super_R
keycode 206 = Control_L NoSymbol Control_L
m@buntoo:~$
xev
? – Andra May 15 '18 at 18:10xev
. It reportsSuper_L
is indeed 133, but does something different forCtrl
which, inconveniently in this case, switches windows. I'll update my script to remove, assign, then add and report back. – Michael Fulton May 15 '18 at 18:15