You are not logged in.

#1 2025-05-28 00:47:42

flatmoll
Member
Registered: 2024-12-01
Posts: 45

[SOLVED] Binding unusual laptop keys

For my laptop that ships with Windows, I have figured out that upper row "Cast" button merely simulates "Super+P" (and a couple of neighboring buttons act the same), therefore the binding fix for sway was just:

bindsym $mod+p exec ...

There is also a button that depicts a designer's faultsome non-associative symbol (probably assistant or AI) that is recognized as Super+Shift+XF86Assistant by wev. It would be perfectly ok, but wev appears to be the only program to catch this "XF86Assistant" part -- sway takes it as Super+Shift, and Emacs as s-<0x10081247>. Setting it to something or remapping Super+Shift would apparently turn WM experience into a quest.

Wev output:

[08:         wl_seat] name: seat0
[08:         wl_seat] capabilities: pointer keyboard touch 
[10:    xdg_toplevel] configure: width: 0; height: 0
[09:     xdg_surface] configure: serial: 17935
[14:     wl_keyboard] keymap: format: 1 (xkb v1), size: 69558
[14:     wl_keyboard] repeat_info: rate: 25 keys/sec; delay: 600 ms
[14:     wl_keyboard] enter: serial: 17939; surface: 3
                      sym: Return       (65293), utf8: '
'
[14:     wl_keyboard] modifiers: serial: 0; group: 0
                      depressed: 00000000
                      latched: 00000000
                      locked: 00000000
[11:  wl_data_device] data_offer: id: 4278190080
[4278190080:   wl_data_offer] offer: mime_type: text/html
[4278190080:   wl_data_offer] offer: mime_type: text/_moz_htmlcontext
[4278190080:   wl_data_offer] offer: mime_type: text/_moz_htmlinfo
[4278190080:   wl_data_offer] offer: mime_type: text/plain;charset=utf-8
[4278190080:   wl_data_offer] offer: mime_type: UTF8_STRING
[4278190080:   wl_data_offer] offer: mime_type: COMPOUND_TEXT
[4278190080:   wl_data_offer] offer: mime_type: TEXT
[4278190080:   wl_data_offer] offer: mime_type: text/plain
[4278190080:   wl_data_offer] offer: mime_type: STRING
[4278190080:   wl_data_offer] offer: mime_type: text/x-moz-url-priv
[4278190080:   wl_data_offer] offer: mime_type: SAVE_TARGETS
[11:  wl_data_device] selection: id: 4278190080
[10:    xdg_toplevel] configure: width: 766; height: 958
                      activated tiled-left tiled-right tiled-top tiled-bottom 
[09:     xdg_surface] configure: serial: 17936

# this is just return key pressed to start wev
[14:     wl_keyboard] key: serial: 17941; time: 17419443; key: 36; state: 0 (released)
                      sym: Return       (65293), utf8: ''

# Here goes the weirdo key
[14:     wl_keyboard] key: serial: 17942; time: 17421648; key: 133; state: 1 (pressed)
                      sym: Super_L      (65515), utf8: ''
[14:     wl_keyboard] modifiers: serial: 0; group: 0
                      depressed: 00000040: Mod4 
                      latched: 00000000
                      locked: 00000000
[14:     wl_keyboard] key: serial: 17946; time: 17421651; key: 50; state: 1 (pressed)
                      sym: Shift_L      (65505), utf8: ''
[14:     wl_keyboard] modifiers: serial: 0; group: 0
                      depressed: 00000041: Shift Mod4 
                      latched: 00000000
                      locked: 00000000
[14:     wl_keyboard] key: serial: 17950; time: 17421653; key: 201; state: 1 (pressed)
                      sym: XF86Assistant (268964423), utf8: ''
[14:     wl_keyboard] key: serial: 17951; time: 17421737; key: 201; state: 0 (released)
                      sym: XF86Assistant (268964423), utf8: ''
[14:     wl_keyboard] key: serial: 17952; time: 17421743; key: 50; state: 0 (released)
                      sym: Shift_L      (65505), utf8: ''
[14:     wl_keyboard] modifiers: serial: 0; group: 0
                      depressed: 00000040: Mod4 
                      latched: 00000000
                      locked: 00000000
[14:     wl_keyboard] key: serial: 17954; time: 17421751; key: 133; state: 0 (released)
                      sym: Super_L      (65515), utf8: ''
[14:     wl_keyboard] modifiers: serial: 0; group: 0
                      depressed: 00000000
                      latched: 00000000
                      locked: 00000000

# This is just Super+Shift+Q to exit wev
[14:     wl_keyboard] key: serial: 17957; time: 17422842; key: 133; state: 1 (pressed)
                      sym: Super_L      (65515), utf8: ''
[14:     wl_keyboard] modifiers: serial: 0; group: 0
                      depressed: 00000040: Mod4 
                      latched: 00000000
                      locked: 00000000
[14:     wl_keyboard] key: serial: 17963; time: 17422914; key: 50; state: 1 (pressed)
                      sym: Shift_L      (65505), utf8: ''
[14:     wl_keyboard] modifiers: serial: 0; group: 0
                      depressed: 00000041: Shift Mod4 
                      latched: 00000000
                      locked: 00000000
[10:    xdg_toplevel] close

Is there anything I can do? The piece of engineering takes the legitimate place of right ctrl.

Last edited by flatmoll (2025-05-31 17:11:54)

Offline

#2 2025-05-28 06:24:11

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

Re: [SOLVED] Binding unusual laptop keys

Do you use emacs or https://archlinux.org/packages/?name=emacs-wayland ?
How do you assess the sway-itself behavior?
The limitation is probably on xwayland.

You're not getting out of the keyboard generating a combo but maybe can https://wiki.archlinux.org/title/Map_sc … o_keycodes or https://wiki.archlinux.org/title/Input_remap_utilities to map it away from XF86Assistant into eg XF86Search, https://bugzilla.redhat.com/show_bug.cgi?id=1615700

Offline

#3 2025-05-31 17:11:30

flatmoll
Member
Registered: 2024-12-01
Posts: 45

Re: [SOLVED] Binding unusual laptop keys

I use emacs-wayland from the 'Extra' repo.
Sway doesn't respond to this key alone, but using it as Super+Shift works (e.g., {this key}+Q closes focused window).
Some of my apps require xwayland, so disabling it is not my case.

Thanks for the links! I was trying udev, but realized that setkeycodes works to remap XF86Assistant. https://wiki.archlinux.org/title/Map_sc … etkeycodes

Offline

#4 2025-06-04 15:43:27

VanClaussen
Member
Registered: 2019-11-14
Posts: 3

Re: [SOLVED] Binding unusual laptop keys

Could you specify how exactly you managed to remap XF86Assistant? I'm struggling.
Thanks!

Offline

#5 2025-06-07 02:04:31

flatmoll
Member
Registered: 2024-12-01
Posts: 45

Re: [SOLVED] Binding unusual laptop keys

VanClaussen wrote:

Could you specify how exactly you managed to remap XF86Assistant? I'm struggling.
Thanks!

Hello!

Obtain a -> Hex Scancode <- of a problematic key with evtest (to the right of MSC_SCAN, see section 1.1 of https://wiki.archlinux.org/title/Keyboa … _scancodes). Notice that keyboard will give you a combo, but you need to look for the Scancode of XF86Assistant only. In my case it was 6e.

The same way, obtain a -> Decimal Keycode <- of the desired key (to the left of KEY_{KEYNAME}, see the same section). The new combo will be $mod+Shift+{desired_key}, thus avoid remapping to existing bindings.

Remap with (afaik a built-in program)

# setkeycodes scancode keycode

https://wiki.archlinux.org/title/Map_sc … etkeycodes

You can see by these links that there are other ways to remap, this is just how I did it.

Last edited by flatmoll (2025-06-07 02:05:51)

Offline

#6 2025-06-08 16:00:44

VanClaussen
Member
Registered: 2019-11-14
Posts: 3

Re: [SOLVED] Binding unusual laptop keys

Hi,
thank you!

I used showkey to figure out the code but it was wrong (the wiki warns about this but I didn't see it). evtest did report the correct one.

For me it was:

# setkeycodes 6e 16

Keycode should be subtracted by 8 to get the right key (25, Q, is 16 for setkeycodes on my device).

Offline

Board footer

Powered by FluxBB