3

In X11 I'm using the Hyper key, is it possible to configure a hyper key for wayland?

2 Answers 2

0

Yes, it's possible.

Wayland uses XKB which supports the "Hyper". Note that unlikely other modifiers, this doesn't map to a standard key-code, so the key needs to be configured.

The simplest way to do this is using XKB options:

You can enable the caps:hyper option, e.g.

  • Though the environment variable:

    XKB_DEFAULT_OPTIONS="caps:hyper"

  • Or via graphical tools (gnome-tweak, gconf... etc).

  • For other options see: /usr/share/X11/xkb/rules/base.lst

    > cat /usr/share/X11/xkb/rules/base.lst | grep hyper
    ctrl:hyper_capscontrol Caps Lock as Ctrl, Ctrl as Hyper
    caps:hyper           Make Caps Lock an additional Hyper
    altwin:hyper_win     Hyper is mapped to Win
    

Another option could be to create a custom keyboard layout, this is quite involved, just noting that it's an alternative to mapping CapsLock to Hyper.


To test this is working, use a tool that prints events such as wev.

The output should look like this:

state: 1 (pressed)
                      sym: Hyper_L      (65517), utf8: ''
[14:     wl_keyboard] modifiers: serial: 0; group: 16
                      depressed: 00000020: Mod3 
                      latched: 00000000
                      locked: 00000010: Mod2 
[14:     wl_keyboard] key: serial: 6472; time: 153582091; key: 66; state: 0 (released)
                      sym: Hyper_L      (65517), utf8: ''
[14:     wl_keyboard] modifiers: serial: 0; group: 16
                      depressed: 00000000
                      latched: 00000000
                      locked: 00000010: Mod2 
-1

Hyper is the combination of CTRL, ALT and SUPER

At least that's how the R_ALT-to-Hyper plugin for the HID evdev Interception tools does it.

The Evdev layer is lower than X11 and Wayland, so Hyper becomes available in whatever UI system you use.

1
  • 2
    IMHO, it is incorrect to consider a modifier to be the combination of other modifiers, as we are supposed to be able to use modifiers together (I expect to be able to use CTRL+ALT+SUPER+a, HYPER+a, and CTRL+ALT+SUPER+HYPER+a, all being different). At least, Emacs sees correctly CTRL+Alt+SUPER+a as C-M-s-a and HYPER+a as H-a on X11, which allows different actions. Note that (Emacs) CONTROL+ALT+SUPER+HYPER+a is seen as C+H+M+s+a. Commented Jun 1, 2023 at 7:40

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.