Hyprland modifiers MOD5 and MOD3

Hi guys, I’m very new to hyprland and while exploring the bindings possibilities, I wondered what were these modifiers : MOD2, MOD3, MOD5.

After some trials, I pinned down what they were tied to : your xkb layout iso level setup.

  • MOD5 is iso level 3
  • MOD3 is iso level 5
  • MOD2 : no idea

NOTE : I may need to open a ticket so the hyprland modifiers name matches their xkb iso level number

my xkb layout has set up Caps Lock to be the iso level 5 modifier, thus the hyprland.conf CAPS modifier is never triggered.

iso level shifts… if you wonder what it is, buckle up, here is a quick rundown.

Iso Level Shift

in xkb, iso level shift are the modifiers, and you can set them up to be bound to this or that key. I’m simplifying it, but that is the idea.
For the sake of simplicity, let’s call these IL (Iso Level).

in linux, xkb is in charge of defining the available keyboard layouts, and files in /usr/share/X11/xkb/symbols/ defines them. (beware that creating a new definition here is not enough, but this is out of scope here)

Let’s look at a sample of the "basic" US layout (/usr/share/X11/xkb/symbols/us)

    key <AE12>	{[   equal,	 plus		]};

We can intuitively understand what each of the two columns are made for :

  • column 0 : character output when no modifiers is pressed
  • column 1 : character output when the shift modifier is pressed

As far as I know, Shift is always the IL2. It seems it is always automatically set up, even though it seems possible to bind IL2 to another key.

Now, let’s look at a sample of the "intl" US layout for the same key as previously, still in the same file :

    key <AE12> { [     equal,       plus,      multiply,         division ] };
    // ... some other key definitions further
    include "level3(ralt_switch)"

Here, we can see the IL3 has been included and set up as Right Alt, aka AltGr
Which has open up to 4 layers (column) of key configurations as we can see.

  • column 0 : character output when no modifiers is pressed
  • column 1 : character output when the IL2 modifier is pressed
  • column 3 : character output when the IL3 modifier is pressed
  • column 4 : character output when the IL3+IL2 modifiers are pressed

each column correspond to a modifier combo.

In my layout, where I have included an IL3 and an IL5, I can have 8 layers of configurations per key.

in order to know which column correspond to which combo, you can represent all the IL state in a binary number, where each bit correspond to the sate of an IL :

IL5--0 0 0--IL2
       |
      IL3

if I press IL5+IL2, it gives the binary 101, which is 5 in decimal, there you have the number of the column, but remember that the first column, is the column number 0 !