[HOW-TO] Convert caps lock to hyper key

I stumbled across this today. I have been using xmodmap for years to do this, but it has issues, it has a tendency to stop working.

cd /usr/share/X11/xkb/symbols
sudo cp gb hyper #Replace gb with your locale 
sudo nano hyper

Add the following code within the { }s of xkb_symbols “basic”.

key <CAPS> {[ Hyper_L ]};
key <HYPR> {[ Hyper_R , Hyper_L	]};
modifier_map Mod3   { <HYPR> };

Ensure that there are no syntax errors

setxkbmap -layout hyper

If there are syntax errors, the command will refuse to load the layout.

The Capslock should be converted to Hyper now. You can test it by setting shortcuts to something in your window manager.

setxkbmap only loads the layout for current session. To make the changes permanent, use the following command

localectl --no-convert set-x11-keymap hyper

Source: https://ibnishak.github.io/blog/post/caps-to-hyper/

You will probably want to add to your startup:

setxkbmap -option shift:both_capslock

To regain caps lock function (by pressing both shifts together).

Plasma cannot see the hyper key, but sxhkd can be used to add additional hotkeys.

hyper+KP_Add
    bopp

hyper+KP_Subtract
    bopm

hyper+Tab
  skippy-xd --toggle-window-picker

hyper+d
    rofi -show drun
1 Like

I’m assuming this is for XFCE?

Gnome (in tweaks) and Plasma have this functionality built right in and just need to have the box checked. I’ve been using caps as an extra super key for quite a while now.

Hyper is not super, it is a totally seperate modifier dating back to the old lisp machines (space-cadet keyboard - a thing of beauty and fear!).

So I now have:

  • Control
  • Super (meta on plasma)
  • Hyper
  • Alt (or meta on emacs).
    I never get why plasma calls super meta :rofl:
1 Like

GNOME:

1 Like

KDE:

1 Like

I’m not aware of a way of doing it in xfce - and I’ll have Cinnamon up and going shortly. It’s been a while, but I can’t recall if Cinnamon has the setting or not. xfce is definitely the least refined of the big 3 desktops.

That being said, it’s super stable because it’s slow going on new features.

Easy enough (though not on GUI) to change the Caps lock to another key, or stop it from acting - but I don’t know how to set ‘Hyper’.