You are not logged in.

#1 2021-11-03 22:03:50

leonixyz
Member
Registered: 2014-07-12
Posts: 63

[SOLVED] Different keyboard keys having the same keycode/keysym

I bought a new Framework Laptop (https://frame.work) and I have some troubles with a specific keyboard key, which is firing the very same X event as another one.

* The first one is the "Windows" key bottom left between FN and ALT
* The second one is the "Second Monitor" key, on the same key as F9

Here is a picture of the keyboard

This is how they show up in xev:

Windows

KeyPress event, serial 34, synthetic NO, window 0x1a00001,
    root 0x7a8, subw 0x0, time 1647680, (113,303), root:(1244,334),
    state 0x0, keycode 133 (keysym 0xffeb, Super_L), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

Second monitor (for some reason, on key press, two events are logged)

KeyPress event, serial 34, synthetic NO, window 0x1a00001,
    root 0x7a8, subw 0x0, time 1692763, (90,543), root:(1221,574),
    state 0x0, keycode 133 (keysym 0xffeb, Super_L), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

FocusOut event, serial 34, synthetic NO, window 0xa00001,
    mode NotifyGrab, detail NotifyAncestor

I have added the following Xorg config, but removing it and restarting X does not make any difference

$ cat /etc/X11/xorg.conf.d/20-keyboard.conf 
Section "InputClass"
    Identifier "keyboard"
    MatchIsKeyboard "yes"
    Option "XkbLayout" "us"
    Option "XkbVariant" "nodeadkeys"
EndSection

Is there anything i can do to distinguish between the two keys?

Last edited by leonixyz (2021-11-05 19:35:42)

Offline

#2 2021-11-04 07:24:49

seth
Member
Registered: 2012-09-03
Posts: 58,693

Re: [SOLVED] Different keyboard keys having the same keycode/keysym

Please remove the oversized image (or replace it w/ a link and thumbnail - the board limit is 250x250 px)

The key actually fires a sequence (Win+something) and that sequence is actually currently grabbed by something (some daemon of your desktop environment, I guess - you could try it in a "naked" X11 session w/ just an xterm)
This isn't uncommon and the shortcut is most likely win+p

Offline

#3 2021-11-05 18:26:35

leonixyz
Member
Registered: 2014-07-12
Posts: 63

Re: [SOLVED] Different keyboard keys having the same keycode/keysym

seth wrote:

The key actually fires a sequence (Win+something) and that sequence is actually currently grabbed by something (some daemon of your desktop environment, I guess - you could try it in a "naked" X11 session w/ just an xterm)
This isn't uncommon and the shortcut is most likely win+p

Thank you Seth.

a naked X11 session returns, as you said win+p

KeyPress event, serial 28, synthetic NO, window 0x600001,
    root 0x7a8, subw 0x0, time 518727, (171,175), root:(173,177),
    state 0x0, keycode 133 (keysym 0xffeb, Super_L), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyPress event, serial 28, synthetic NO, window 0x600001,
    root 0x7a8, subw 0x0, time 518727, (171,175), root:(173,177),
    state 0x40, keycode 33 (keysym 0x70, p), same_screen YES,
    XLookupString gives 1 bytes: (70) "p"
    XmbLookupString gives 1 bytes: (70) "p"
    XFilterEvent returns: False

I am on i3, the default config maps $mod+p to "scratchpad show". I changed it, and set win+p to start arandr instead. Now when i press that key, arandr is executed.

Obviously (maybe not?) now arandr is also started when I "really" press win+p.

I suppose there is no other way around, right? I should re-map "scratchpad show" to something different and live with the fact that also win+p will launch arandr. Is this correct?

Thanks

Last edited by leonixyz (2021-11-05 18:27:47)

Offline

#4 2021-11-05 19:05:14

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,330
Website

Re: [SOLVED] Different keyboard keys having the same keycode/keysym

Theoretically, you could write a daemon process that would watch for these events and treat win+p different depending on whether the event times were the same or not, as your "Second monitor" key sends the "win" and "p" with the same event time, while pretty much any natural press of win+p keys will have different event times.

But that's all theoretically.  In practice that'd be a lot of hassle for very little benefit.  Changing your scratchpad binding to something else seems like a no-brainer to me.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

Board footer

Powered by FluxBB