I am trying to use shortcuts in Gnome that involve the hyper-key. I can successfully add them as shown in the picture here:
My hyper key is remapped from caps lock via setxkbmap -option "caps:hyper"
.
Hyper works correctly in, e.g., Emacs. (When I push Caps-Lock-A, Emacs says H-a is undefined
.)
But when I press Caps-Lock-A, the shortcut is not executed. (E.g., in the terminal, it simply inserts the letter a
.)
How to support hyper in Gnome shortcuts? (Or short cuts involving caps lock in another way but not remapped to super because I want separate super and caps-lock shortcuts.)
I found a solution for my own problem with the Hyper key, maybe this solution works for you as well (If you are using Xorg. I guess the solution doesn't work with Wayland...):
First I mapped Caps to Hyper in the tweaks program:
But when I add a shortcut in Gnome Settings then the Shortcut was recognized as Super instead of Hyper. The problem seems to be that Super and Hyper is both mapped to mod4 in xmodmap:
$ xmodmap -pm
xmodmap: up to 5 keys per modifier, (keycodes in parentheses):
shift Shift_L (0x32), Shift_R (0x3e)
lock
control Control_L (0x25), Control_R (0x69)
mod1 Alt_L (0x40), Meta_L (0xcd)
mod2 Num_Lock (0x4d)
mod3
mod4 Hyper_L (0x42), Super_L (0x85), Super_R (0x86), Super_L (0xce), Hyper_L (0xcf)
mod5 ISO_Level3_Shift (0x5c), Mode_switch (0xcb)
This command moves Hyper_L to mod3:
$ xmodmap -e "remove mod4 = Hyper_L" -e "add mod3 = Hyper_L"
Create $HOME/.config/autostart/xmodmap.desktop
with the following content to run this xmodmap command on startup:
[Desktop Entry]
Name=Xmodmap
Exec=xmodmap -e "remove mod4 = Hyper_L" -e "add mod3 = Hyper_L"
Terminal=false
Type=Application
Now Hyper is correctly recognized in keyboard shortcut settings and the shortcuts are working fine.