You are not logged in.

#1 2024-12-02 16:26:20

jay-tux
Member
Registered: 2024-04-07
Posts: 5

[RESOLVED] Remapping "Copilot" key

My new laptop features a "Copilot" key instead of a right Windows key. I'm trying to figure out how to re-bind/remap this key using xmodmap.
The issue is that the physical key seems to produce two keycodes:

libinput debug-events produces:

-event4   KEYBOARD_KEY                +0.000s	KEY_LEFTMETA (125) pressed
 event4   KEYBOARD_KEY                +0.002s	*** (-1) pressed
 event4   KEYBOARD_KEY                +0.105s	*** (-1) released
 event4   KEYBOARD_KEY                +0.113s	KEY_LEFTMETA (125) released

libinput debug-events --show-keycodes produces:

-event4   KEYBOARD_KEY                +0.000s	KEY_LEFTMETA (125) pressed
 event4   KEYBOARD_KEY                +0.003s	KEY_LEFTSHIFT (42) pressed
 event4   KEYBOARD_KEY                +0.131s	KEY_LEFTSHIFT (42) released
 event4   KEYBOARD_KEY                +0.138s	KEY_LEFTMETA (125) released

showkeys produces:

keycode 125 press
keycode  42 press
keycode  42 release
keycode 125 release

Is there a way to have X11 register this as one key (the Windows key), or alternatively, have i3 recognize this combination as an alias for the Mod4 key (while still keeping the Mod4/Windows key as well)?

Last edited by jay-tux (2024-12-03 08:44:14)

Offline

#2 2024-12-02 17:28:49

seth
Member
Registered: 2012-09-03
Posts: 64,007

Re: [RESOLVED] Remapping "Copilot" key

The key seems to fake shift+meta, you'll not be able to turn this into anything else (ie. you could probably map lshift+meta_l to meta_r but pressing shift+meta using the actual keys on the left side would then do the same.
=> Bind the desired shortcuts to shift+meta+x ?

Offline

#3 2024-12-02 17:33:32

jay-tux
Member
Registered: 2024-04-07
Posts: 5

Re: [RESOLVED] Remapping "Copilot" key

=> Bind the desired shortcuts to shift+meta+x ?

You mean duplicating each keybind in my i3-config?

Offline

#4 2024-12-02 17:42:23

seth
Member
Registered: 2012-09-03
Posts: 64,007

Re: [RESOLVED] Remapping "Copilot" key

Ah, you want the right meta key to behave the same as the left meta key?
But you're likely not ready to entirely sacrifice shift+meta?
If you cannot alter the key behavior in the firmware you'll likely end up having to duplicate the entries - there's no way for the OS to tell whether the event came from you pushing the two left keys or the one right key (arguebly one could have a device driver noticing that the keys came in <5 ms and figure: ok, that's not the humanoid, I'll map that somewhere else) but this is very specific and I'm not aware of some libinput feature for that.

If the copilot keys all end up doing this, it might be worth a request at libinput.

Offline

#5 2024-12-02 17:47:27

jay-tux
Member
Registered: 2024-04-07
Posts: 5

Re: [RESOLVED] Remapping "Copilot" key

Oh, I'm totally fine "merging" left and right meta into one, or having the system treat shift+meta as meta.
My config doesn't use Shift+Meta anywhere (as far as I'm aware).

Can I have i3 treat both L_META and SHIFT+R_META as Mod4?

Offline

#6 2024-12-02 17:57:40

seth
Member
Registered: 2012-09-03
Posts: 64,007

Offline

#7 2024-12-02 18:34:33

jay-tux
Member
Registered: 2024-04-07
Posts: 5

Re: [RESOLVED] Remapping "Copilot" key

Alright, after messing around, I found a solution. Thanks, seth!

For those curious: this is the resulting keyd config:

[ids]
*

[main]

[meta]
shift = layer(meta)

Offline

#8 2024-12-02 20:49:40

seth
Member
Registered: 2012-09-03
Posts: 64,007

Re: [RESOLVED] Remapping "Copilot" key

\o/
Please always remember to mark resolved threads by editing your initial posts subject - so others will know that there's no task left, but maybe a solution to find.
Thanks.

Offline

Board footer

Powered by FluxBB