Hi, I’m using USB HHKB Pro2 keyboard. I want to use ⌘ key as Meta, but KDE seems to recognize it as Muhenkan or Henkan_Mode keys.
Here is the xev
output when I pressed Left ⌘ and Right ⌘ in a row.
KeyPress event, serial 39, synthetic NO, window 0x1200001,
root 0x49a, subw 0x0, time 3530941, (89,97), root:(960,540),
state 0x0, keycode 102 (keysym 0xff22, Muhenkan), same_screen YES,
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False
KeyRelease event, serial 39, synthetic NO, window 0x1200001,
root 0x49a, subw 0x0, time 3531149, (89,97), root:(960,540),
state 0x0, keycode 102 (keysym 0xff22, Muhenkan), same_screen YES,
XLookupString gives 0 bytes:
XFilterEvent returns: False
KeyPress event, serial 39, synthetic NO, window 0x1200001,
root 0x49a, subw 0x0, time 3534053, (89,97), root:(960,540),
state 0x0, keycode 100 (keysym 0xff23, Henkan_Mode), same_screen YES,
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False
KeyRelease event, serial 39, synthetic NO, window 0x1200001,
root 0x49a, subw 0x0, time 3534173, (89,97), root:(960,540),
state 0x0, keycode 100 (keysym 0xff23, Henkan_Mode), same_screen YES,
XLookupString gives 0 bytes:
XFilterEvent returns: False
I used xkbcomp
to display the current keysyms mapped to Muhenkan
or Henkan_Mode
.
$ xkbcomp $DISPLAY - 2>/dev/null | grep 'enkan'
key <HENK> { [ Henkan_Mode ] };
key <MUHE> { [ Muhenkan ] };
Then I replaced Muhenkan
to Super_L
and Henkan_Mode
to Super_R
with the following command.
$ xkbcomp $DISPLAY - 2>/dev/null | sed -e 's/Muhenkan/Super_L/g; s/Henkan_Mode/Super_R/g' | xkbcomp - $DISPLAY 2>/dev/null
Now keysym <MUHE>
is mapped to Super_L
, and <HENK>
is mapped to Super_R
.
$ xkbcomp $DISPLAY - 2>/dev/null | grep 'Super_'
interpret Super_L+AnyOf(all) {
interpret Super_R+AnyOf(all) {
interpret Super_L+AnyOfOrNone(all) {
interpret Super_R+AnyOfOrNone(all) {
key <HENK> { [ Super_R ] };
key <MUHE> { [ Super_L ] };
key <SUPR> { [ NoSymbol, Super_L ] };
I also confirmed that xev
is now showing the correct output when I pressed Left ⌘ and Right ⌘.
KeyPress event, serial 39, synthetic NO, window 0x1200001,
root 0x49a, subw 0x0, time 4306067, (21,61), root:(892,504),
state 0x0, keycode 102 (keysym 0xffeb, Super_L), same_screen YES,
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False
KeyRelease event, serial 39, synthetic NO, window 0x1200001,
root 0x49a, subw 0x0, time 4306235, (21,61), root:(892,504),
state 0x40, keycode 102 (keysym 0xffeb, Super_L), same_screen YES,
XLookupString gives 0 bytes:
XFilterEvent returns: False
KeyPress event, serial 39, synthetic NO, window 0x1200001,
root 0x49a, subw 0x0, time 4306379, (21,61), root:(892,504),
state 0x0, keycode 100 (keysym 0xffec, Super_R), same_screen YES,
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False
KeyRelease event, serial 39, synthetic NO, window 0x1200001,
root 0x49a, subw 0x0, time 4306451, (21,61), root:(892,504),
state 0x40, keycode 100 (keysym 0xffec, Super_R), same_screen YES,
XLookupString gives 0 bytes:
XFilterEvent returns: False
However, KDE is still recognizing Left ⌘ as Muhenkan when I tried to add some shortcuts with ⌘ modifier.
I also tried remapping with xmodmap
using the following command, but the results are the same.
cat <<\EOF >> ~/.Xmodmap
keycode 102 = Super_L
keycode 100 = Super_R
EOF
xmodmap ~/.Xmodmap
How can I make KDE to correctly recognize the XKB or xmodmap remappings?
Here is my KDE’s system info.
Operating System: Debian GNU/Linux 12
KDE Plasma Version: 5.27.5
KDE Frameworks Version: 5.103.0
Qt Version: 5.15.8
Kernel Version: 6.1.0-27-amd64 (64-bit)
Graphics Platform: Wayland
Processors: 4 × Intel® Core™ i3-8100 CPU @ 3.60GHz
Memory: 15.3 GiB of RAM
Graphics Processor: Mesa Intel® UHD Graphics 630
Looking for someone’s help.