Hyper mapped by default to Mod3 in xkeyboard-config 2.43 #663

Open
opened 2024-10-15 08:40:53 +02:00 by Wismill · 10 comments

Hi, xkeyboard-config maintainer here.

Hyper is mapped by default to Mod3 since xkeyboard-config 2.43 in order to solve this issue.

However, I got a report that any use of LevelFive modifier in Emacs now triggers Hyper shortcuts. Indeed, both virtual modifiers map now to the real modifier Mod3. Not being a user of Emacs myself, could anybody confirm that?

While the use of the Hyper modifier seems a niche AFAIK, this is obviously not the case of Emacs.

There is a pending merge request to fix this issue. It would be very useful to have your feedback.


By the way, I am big fan of the Neo project (but not using its layouts). Together with Bépo, it got me into tweaking keyboard layouts and I ended a maintainer of xkeyboard-config and libxkbcommon.

Hi, [`xkeyboard-config`](https://gitlab.freedesktop.org/xkeyboard-config/xkeyboard-config/) maintainer here. `Hyper` is mapped by default to `Mod3` since [`xkeyboard-config` 2.43](https://gitlab.freedesktop.org/xkeyboard-config/xkeyboard-config/-/blob/master/ChangeLog.md?ref_type=heads) in order to solve [this issue](https://gitlab.freedesktop.org/xkeyboard-config/xkeyboard-config/-/issues/440). However, I got a report that any use of `LevelFive` modifier in Emacs now triggers `Hyper` shortcuts. Indeed, both [virtual modifiers](https://xkbcommon.org/doc/current/keymap-text-format-v1.html#virtual-modifier-def) map now to the [real modifier](https://xkbcommon.org/doc/current/keymap-text-format-v1.html#real-modifier-def) `Mod3`. Not being a user of Emacs myself, could anybody confirm that? While the use of the `Hyper` modifier seems a niche AFAIK, this is obviously not the case of Emacs. There is a pending [merge request](https://gitlab.freedesktop.org/xkeyboard-config/xkeyboard-config/-/merge_requests/760) to fix this issue. It would be very useful to have your feedback. --- By the way, I am big fan of the Neo project (but not using its layouts). Together with [Bépo](https://bepo.fr/wiki/Accueil), it got me into tweaking keyboard layouts and I ended a maintainer of `xkeyboard-config` and `libxkbcommon`.
qwertfisch added the
Treiber/Linux/xkb
label 2024-10-16 23:38:26 +02:00
Owner

Welcome Wismill!

Just saw this issue. Unfortunately I am not versed in xkb magic (only knowing and doing the Windows part of Neo), but I will ask around in the IRC channel if there might be anyone to test and confirm it.

Welcome Wismill! Just saw this issue. Unfortunately I am not versed in xkb magic (only knowing and doing the Windows part of Neo), but I will ask around in the IRC channel if there might be anyone to test and confirm it.
Author

@qwertfisch Thank you for taking care of this. Can anyone confirm the issue?

@qwertfisch Thank you for taking care of this. Can anyone confirm the issue?
Member

Hi Wismill

I'm currently don't know how I can test this. I have tried to put "setxkbmap -I$HOME/src/xkeyboard-config -rules base de neo" in my .xinitrc (from docs/HOWTO.testing). But this breaks my i3 setup (I have mod on the windows-key). I'm on debian stable with xkeyconfig-config 2.35 installed.

Hi Wismill I'm currently don't know how I can test this. I have tried to put "setxkbmap -I$HOME/src/xkeyboard-config -rules base de neo" in my .xinitrc (from docs/HOWTO.testing). But this breaks my i3 setup (I have mod on the windows-key). I'm on debian stable with xkeyconfig-config 2.35 installed.
Author

@satanist OK, there seems to be 2 issues.


I have tried to put "setxkbmap -I$HOME/src/xkeyboard-config -rules base de neo"

I think you should use evdev rules on modern Linux.

(from docs/HOWTO.testing)

The doc is probably dated (20 years since last meaningful modification 😅


setxkbmap -Ixxx does not work as expected. But xkbcomp -Ixxx does. So in order to test the Neo layout provided by the latest xkeyboard-config release, please follow these steps:

  1. Remove the line above that you added in you .xinitrc and restart a clean session.

  2. Download and extract the 2.43 release, say e.g. in /tmp/xkc-2.43

  3. Build xkeyboard-config:

    # Install meson (https://mesonbuild.com/)
    pip3 install --user meson
    # Setup
    cd /tmp/xkc-2.43
    meson setup --prefix="$PWD/inst" build
    # Build/Install locally
    meson install -C build
    
  4. Under an X11 session, run: setxkbmap -print -rules evdev -layout de -variant neo | xkbcomp -I -I/tmp/xkc-2.43/inst/share/X11/xkb - $DISPLAY.

    Note that the empty -I is intended; i.e. from xkbcomp manual:

    To prevent the current and default directories from being searched, use the -I option alone (i.e. without a directory), before any -I options that specify the directories you do want searched.

    You may add -w 10 to the xkbcomp command to get more verbose output, if necessary.

  5. Run setxkbmap -rules evdev -layout de -variant neo (not in /tmp/xkc-2.43) to get back to you system keyboard layout, or simply relog.


EDIT: fixed xkeyboard-config missing build step.

@satanist OK, there seems to be 2 issues. --- > I have tried to put "setxkbmap -I$HOME/src/xkeyboard-config -rules base de neo" I think you should use `evdev` rules on modern Linux. > (from docs/HOWTO.testing) The doc is probably dated (20 years since last meaningful modification 😅 --- `setxkbmap -Ixxx` does not work as expected. But `xkbcomp -Ixxx` does. So in order to test the Neo layout provided by the latest `xkeyboard-config` release, please follow these steps: 0. Remove the line above that you added in you `.xinitrc` and restart a clean session. 1. Download and extract the [2.43 release](https://www.x.org/releases/individual/data/xkeyboard-config/xkeyboard-config-2.43.tar.xz), say e.g. in `/tmp/xkc-2.43` 2. Build `xkeyboard-config`: ```bash # Install meson (https://mesonbuild.com/) pip3 install --user meson # Setup cd /tmp/xkc-2.43 meson setup --prefix="$PWD/inst" build # Build/Install locally meson install -C build ``` 3. Under an X11 session, run: `setxkbmap -print -rules evdev -layout de -variant neo | xkbcomp -I -I/tmp/xkc-2.43/inst/share/X11/xkb - $DISPLAY`. Note that the *empty* `-I` is intended; i.e. from `xkbcomp` manual: > To prevent the current and default directories from being searched, use the -I option alone (i.e. without a directory), before any -I options that specify the directories you do want searched. You may add `-w 10` to the `xkbcomp` command to get more verbose output, if necessary. 4. Run `setxkbmap -rules evdev -layout de -variant neo` (*not* in `/tmp/xkc-2.43`) to get back to you system keyboard layout, or simply relog. --- EDIT: fixed `xkeyboard-config` missing build step.
Member

@Wismill I think there is some parts in your explanation missing.

First of all I think the command should be something like ... | xkbcomp -I -I/tmp/xkc-2.43 - $DISPLAY.

Next when I try to run this without any -I the neo-mod4 aren't working.

When including the xkc dir I get following error:

X Error of failed request:  BadValue (integer parameter out of range for operation)
  Major opcode of failed request:  135 (XKEYBOARD)
  Minor opcode of failed request:  9 (XkbSetMap)
  Value in failed request:  0x1314001a
  Serial number of failed request:  113
  Current serial number in output stream:  119

I have also attached the full output of the command with xkc-2.43. This conntains an error about the HYPR key. This error is gone when I manual include the linked merge request.

Btw: sorry for the long delay

@Wismill I think there is some parts in your explanation missing. First of all I think the command should be something like `... | xkbcomp -I -I/tmp/xkc-2.43 - $DISPLAY`. Next when I try to run this without any -I the neo-mod4 aren't working. When including the xkc dir I get following error: ``` X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 135 (XKEYBOARD) Minor opcode of failed request: 9 (XkbSetMap) Value in failed request: 0x1314001a Serial number of failed request: 113 Current serial number in output stream: 119 ``` I have also attached the full output of the command with xkc-2.43. This conntains an error about the HYPR key. This error is gone when I manual include the linked merge request. Btw: sorry for the long delay
Author

First of all I think the command should be something like ... | xkbcomp -I -I/tmp/xkc-2.43 - $DISPLAY.

@satanist you are right, I missed the - before $DISPLAY. But I also forgot that the xkeyboard-config link above is only a source tarball: you need to build it. I fixed my previous comment, please git it another try.

However, that does not explain the following error:

X Error of failed request: BadValue (integer parameter out of range for operation)

It seems there is an issue with the X server that is not obvious to reproduce.

  • On KDE Plasma 6.2:
    • On a X11 session, the command setxkbmap … | xkbcomp … works on first try.
    • On a Wayland1 session, I get a similar error than you. But, if I then run e.g. setxkbmap -layout de then re-run our command, it works!
  • On IceWM (X11) I have no issue.

  1. Note that setxkbmap is not the correct way to change layout in a Wayland session: it will only affect X11 apps. ↩︎

> First of all I think the command should be something like `... | xkbcomp -I -I/tmp/xkc-2.43 - $DISPLAY`. @satanist you are right, I missed the `-` before `$DISPLAY`. But I also forgot that the `xkeyboard-config` link above is only a *source* tarball: you need to *build* it. I fixed [my previous comment](https://git.neo-layout.org/neo/neo-layout/issues/663#issuecomment-4661), please git it another try. However, that does not explain the following error: > X Error of failed request: BadValue (integer parameter out of range for operation) > … It seems there is an issue with the X server that is not obvious to reproduce. - On KDE Plasma 6.2: - On a X11 session, the command `setxkbmap … | xkbcomp …` works on first try. - On a Wayland[^1] session, I get a similar error than you. *But*, if I then run e.g. `setxkbmap -layout de` *then* re-run our command, it works! - On IceWM (X11) I have no issue. [^1]: Note that `setxkbmap` is not the correct way to change layout in a Wayland session: it will only affect X11 apps.
Member

I belive there is some X extension missing which gets autoloaded by setxkbmap when needed. Because when I run setxkbmap de neo before I run xkbcomp it's working.

When getting this loaded I can't use Ebene4 (and Ebene6) or X Level5 (and Level7). I have also tried what happens when I remove the mod3 -> hyper mapping. But with this change the Ebene4 also doesn't work.

I have looked at the initial merge request and I would say changing Mod4 to Mod3 breaks neo (and friends).

Ps: it's meson setup --prefix="$PWD/inst" build and you missed the - again
Pps: would be nice when you add something like this to the repo docs, so other can simpler test the current state.

I belive there is some X extension missing which gets autoloaded by setxkbmap when needed. Because when I run `setxkbmap de neo` before I run `xkbcomp` it's working. When getting this loaded I can't use Ebene4 (and Ebene6) or X Level5 (and Level7). I have also tried what happens when I remove the mod3 -> hyper mapping. But with this change the Ebene4 also doesn't work. I have looked at the initial [merge request](https://gitlab.freedesktop.org/xkeyboard-config/xkeyboard-config/-/merge_requests/694) and I would say changing Mod4 to Mod3 breaks neo (and friends). Ps: it's `meson setup --prefix="$PWD/inst" build` and you missed the `-` again Pps: would be nice when you add something like this to the repo docs, so other can simpler test the current state.
Author

I belive there is some X extension missing which gets autoloaded by setxkbmap when needed. Because when I run setxkbmap de neo before I run xkbcomp it's working.

@satanist Glad you confirm. X11 land is such a mess 😅

When getting this loaded I can't use Ebene4 (and Ebene6) or X Level5 (and Level7). I have also tried what happens when I remove the mod3 -> hyper mapping. But with this change the Ebene4 also doesn't work.

I do not reproduce this. What is the output of xev -event keyboard for such config and key sequence?

Ps: it's meson setup --prefix="$PWD/inst" build and you missed the - again

Oups, fixed?!

Pps: would be nice when you add something like this to the repo docs, so other can simpler test the current state.

I think so too: see the corresponding MR.

> I belive there is some X extension missing which gets autoloaded by setxkbmap when needed. Because when I run `setxkbmap de neo` before I run `xkbcomp` it's working. @satanist Glad you confirm. X11 land is such a mess 😅 > When getting this loaded I can't use Ebene4 (and Ebene6) or X Level5 (and Level7). I have also tried what happens when I remove the mod3 -> hyper mapping. But with this change the Ebene4 also doesn't work. I do not reproduce this. What is the output of `xev -event keyboard` for such config and key sequence? > Ps: it's `meson setup --prefix="$PWD/inst" build` and you missed the `-` again Oups, fixed?! > Pps: would be nice when you add something like this to the repo docs, so other can simpler test the current state. I think so too: see the [corresponding MR](https://gitlab.freedesktop.org/xkeyboard-config/xkeyboard-config/-/merge_requests/768).
Member

When getting this loaded I can't use Ebene4 (and Ebene6) or X Level5 (and Level7). I have also tried what happens when I remove the mod3 -> hyper mapping. But with this change the Ebene4 also doesn't work.

I do not reproduce this. What is the output of xev -event keyboard for such config and key sequence?

I messed up a bit on first testing (forgot to open a new client).

So what I have tested now is following:

  1. start a new X session (without any .XCompose or setxkbmap)
  2. run setxkbmap -print -rules evdev -layout de -variant neo | xkbcomp - "$DISPLAY" (I'm not sure if this change the results)
  3. run setxkbmap -print -rules evdev -layout de -variant neo | xkbcomp -I -I/tmp/xkc-2.43/inst/share/X11/xkb - "$DISPLAY"
  4. open a new terminal (rxvt-unicode)
  5. tested all "Ebenen" in the terminal and in emacs (everything works as expected)

Here the xev output for a Level5 key event:

KeyPress event, serial 28, synthetic NO, window 0x1400001,
    root 0x7cd, subw 0x0, time 51777872, (415,676), root:(1379,696),
    state 0x0, keycode 94 (keysym 0xfe11, ISO_Level5_Shift), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyPress event, serial 28, synthetic NO, window 0x1400001,
    root 0x7cd, subw 0x0, time 51779302, (415,676), root:(1379,696),
    state 0x20, keycode 45 (keysym 0xffb5, KP_5), same_screen YES,
    XKeysymToKeycode returns keycode: 84
    XLookupString gives 1 bytes: (35) "5"
    XmbLookupString gives 1 bytes: (35) "5"
    XFilterEvent returns: False

KeyRelease event, serial 28, synthetic NO, window 0x1400001,
    root 0x7cd, subw 0x0, time 51779605, (415,676), root:(1379,696),
    state 0x20, keycode 45 (keysym 0xffb5, KP_5), same_screen YES,
    XKeysymToKeycode returns keycode: 84
    XLookupString gives 1 bytes: (35) "5"
    XFilterEvent returns: False

KeyRelease event, serial 28, synthetic NO, window 0x1400001,
    root 0x7cd, subw 0x0, time 51780101, (415,676), root:(1379,696),
    state 0x20, keycode 94 (keysym 0xfe13, ISO_Level5_Lock), same_screen YES,
    XKeysymToKeycode returns keycode: 23
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False

and the output for a Level3 event:

KeyPress event, serial 28, synthetic NO, window 0x1400001,
    root 0x7cd, subw 0x0, time 51868289, (663,556), root:(1627,576),
    state 0x0, keycode 66 (keysym 0xfe03, ISO_Level3_Shift), same_screen YES,
    XKeysymToKeycode returns keycode: 51
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyPress event, serial 28, synthetic NO, window 0x1400001,
    root 0x7cd, subw 0x0, time 51868664, (663,556), root:(1627,576),
    state 0x80, keycode 44 (keysym 0x28, parenleft), same_screen YES,
    XKeysymToKeycode returns keycode: 187
    XLookupString gives 1 bytes: (28) "("
    XmbLookupString gives 1 bytes: (28) "("
    XFilterEvent returns: False

KeyRelease event, serial 28, synthetic NO, window 0x1400001,
    root 0x7cd, subw 0x0, time 51869065, (663,556), root:(1627,576),
    state 0x80, keycode 44 (keysym 0x28, parenleft), same_screen YES,
    XKeysymToKeycode returns keycode: 187
    XLookupString gives 1 bytes: (28) "("
    XFilterEvent returns: False

KeyRelease event, serial 28, synthetic NO, window 0x1400001,
    root 0x7cd, subw 0x0, time 51869544, (663,556), root:(1627,576),
    state 0x80, keycode 66 (keysym 0xfe03, ISO_Level3_Shift), same_screen YES,
    XKeysymToKeycode returns keycode: 51
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False
> > When getting this loaded I can't use Ebene4 (and Ebene6) or X Level5 (and Level7). I have also tried what happens when I remove the mod3 -> hyper mapping. But with this change the Ebene4 also doesn't work. > > I do not reproduce this. What is the output of `xev -event keyboard` for such config and key sequence? I messed up a bit on first testing (forgot to open a new client). So what I have tested now is following: 1. start a new X session (without any .XCompose or setxkbmap) 2. run `setxkbmap -print -rules evdev -layout de -variant neo | xkbcomp - "$DISPLAY"` (I'm not sure if this change the results) 3. run `setxkbmap -print -rules evdev -layout de -variant neo | xkbcomp -I -I/tmp/xkc-2.43/inst/share/X11/xkb - "$DISPLAY"` 4. open a new terminal (rxvt-unicode) 5. tested all "Ebenen" in the terminal and in emacs (everything works as expected) Here the xev output for a Level5 key event: ``` KeyPress event, serial 28, synthetic NO, window 0x1400001, root 0x7cd, subw 0x0, time 51777872, (415,676), root:(1379,696), state 0x0, keycode 94 (keysym 0xfe11, ISO_Level5_Shift), same_screen YES, XLookupString gives 0 bytes: XmbLookupString gives 0 bytes: XFilterEvent returns: False KeyPress event, serial 28, synthetic NO, window 0x1400001, root 0x7cd, subw 0x0, time 51779302, (415,676), root:(1379,696), state 0x20, keycode 45 (keysym 0xffb5, KP_5), same_screen YES, XKeysymToKeycode returns keycode: 84 XLookupString gives 1 bytes: (35) "5" XmbLookupString gives 1 bytes: (35) "5" XFilterEvent returns: False KeyRelease event, serial 28, synthetic NO, window 0x1400001, root 0x7cd, subw 0x0, time 51779605, (415,676), root:(1379,696), state 0x20, keycode 45 (keysym 0xffb5, KP_5), same_screen YES, XKeysymToKeycode returns keycode: 84 XLookupString gives 1 bytes: (35) "5" XFilterEvent returns: False KeyRelease event, serial 28, synthetic NO, window 0x1400001, root 0x7cd, subw 0x0, time 51780101, (415,676), root:(1379,696), state 0x20, keycode 94 (keysym 0xfe13, ISO_Level5_Lock), same_screen YES, XKeysymToKeycode returns keycode: 23 XLookupString gives 0 bytes: XFilterEvent returns: False ``` and the output for a Level3 event: ``` KeyPress event, serial 28, synthetic NO, window 0x1400001, root 0x7cd, subw 0x0, time 51868289, (663,556), root:(1627,576), state 0x0, keycode 66 (keysym 0xfe03, ISO_Level3_Shift), same_screen YES, XKeysymToKeycode returns keycode: 51 XLookupString gives 0 bytes: XmbLookupString gives 0 bytes: XFilterEvent returns: False KeyPress event, serial 28, synthetic NO, window 0x1400001, root 0x7cd, subw 0x0, time 51868664, (663,556), root:(1627,576), state 0x80, keycode 44 (keysym 0x28, parenleft), same_screen YES, XKeysymToKeycode returns keycode: 187 XLookupString gives 1 bytes: (28) "(" XmbLookupString gives 1 bytes: (28) "(" XFilterEvent returns: False KeyRelease event, serial 28, synthetic NO, window 0x1400001, root 0x7cd, subw 0x0, time 51869065, (663,556), root:(1627,576), state 0x80, keycode 44 (keysym 0x28, parenleft), same_screen YES, XKeysymToKeycode returns keycode: 187 XLookupString gives 1 bytes: (28) "(" XFilterEvent returns: False KeyRelease event, serial 28, synthetic NO, window 0x1400001, root 0x7cd, subw 0x0, time 51869544, (663,556), root:(1627,576), state 0x80, keycode 66 (keysym 0xfe03, ISO_Level3_Shift), same_screen YES, XKeysymToKeycode returns keycode: 51 XLookupString gives 0 bytes: XFilterEvent returns: False ```
Author

@satanist Sorry for the delay. So when trying the 2.43 release, you see no side effect in Emacs? Could that mean that you and this other Emacs user have a different config for Hyper in Emacs, so you have no issue but he has?

EDIT: according to the other Emacs user, error triggers with an empty Emacs config.

@satanist Sorry for the delay. So when trying the 2.43 release, you see no side effect in Emacs? Could that mean that you and this [other Emacs user](https://gitlab.freedesktop.org/xkeyboard-config/xkeyboard-config/-/merge_requests/760#note_2610810) have a different config for Hyper in Emacs, so you have no issue but he has? EDIT: [according to the other Emacs user](https://gitlab.freedesktop.org/xkeyboard-config/xkeyboard-config/-/merge_requests/760#note_2673275), error triggers with an empty Emacs config.
Sign in to join this conversation.
No Milestone
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: neo/neo-layout#663
No description provided.