Bug 464289 - KEY_FULL_SCREEN cannot be used as shortcut
Summary: KEY_FULL_SCREEN cannot be used as shortcut
Status: RESOLVED DUPLICATE of bug 422401
Alias: None
Product: kwin
Classification: Plasma
Component: input (show other bugs)
Version: 5.24.4
Platform: openSUSE Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
: 490785 (view as bug list)
Depends on:
Blocks:
 
Reported: 2023-01-14 17:15 UTC by mpeter.68m0y
Modified: 2024-07-25 20:56 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description mpeter.68m0y 2023-01-14 17:15:19 UTC
SUMMARY
The button with the symbol `KEY_FULL_SCREEN` (key code 372) cannot be set as a custom shortcut.

STEPS TO REPRODUCE
1. Open System Settings
2. Navigate to Workspace -> Shortcuts -> Shortcuts
3. Choose an application or a common action (e.g. Spectacle)
4. Choose an action (e.g. Capture Current Monitor)
5. Click the "Add custom shortcut" button
6. Press the mentioned button on a keyboard that has this key

OBSERVED RESULT
Nothing changes, System Settings keeps waiting for a keypress.
The pressed button (in the GUI) will keep the "Input ..." label, it does not change similarly when a modifier (Ctrl) key has been pressed or in any other way.

EXPECTED RESULT
The pressed key is set up as a custom shortcut

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 5.24.4
KDE Frameworks Version: 5.90.0
Qt Version: 5.15.2

ADDITIONAL INFORMATION
I'm using Wayland.

The mentioned key (`KEY_FULL_SCREEN`) is found on Chromebook devices, in the place of the usual F1-12 keys, which do not exist on this keybord. A list of the special keys of a Chromebook device can be found [here](https://support.google.com/chromebook/answer/1047364?hl=en) ([archive](https://web.archive.org/web/20230111073443/https://support.google.com/chromebook/answer/1047364?hl=en)).
The button in question is the one that has the description of "Make your page take up the full screen".

Both `libinput debug-events` and `wev` can detect this key being pressed.

`libinput debug-events` prints these when pressing and then releasing the key: (also included the line where it shows what device is event0)
```
-event0   DEVICE_ADDED            AT Translated Set 2 keyboard      seat0 default group13 cap:k
 event0   KEYBOARD_KEY            +0.000s       KEY_FULL_SCREEN (372) pressed
 event0   KEYBOARD_KEY            +0.119s       KEY_FULL_SCREEN (372) released
```

`wev`  prints these when pressing and then releasing the key:
```
[14:     wl_keyboard] key: serial: 15054; time: 81214730; key: 380; state: 1 (pressed)
                      sym: NoSymbol     (0), utf8: ''
[14:     wl_keyboard] key: serial: 15055; time: 81214832; key: 380; state: 0 (released)
                      sym: NoSymbol     (0), utf8: ''
```

Seemingly libinput correctly recognizes the key, but Wayland does not anymore, however Wayland sees a different key id.
Comment 1 David Edmundson 2024-07-25 11:16:23 UTC
*** Bug 490785 has been marked as a duplicate of this bug. ***
Comment 2 fanzhuyifan 2024-07-25 16:52:06 UTC
If you run `xmodmap -pke`, is that key mapped? If not I think this should be marked as a duplicate of BUG 422401 -- currently we cannot handle keys not mapped in the keymap.
Comment 3 mpeter.68m0y 2024-07-25 18:25:00 UTC
(In reply to fanzhuyifan from comment #2)
> If you run `xmodmap -pke`, is that key mapped? If not I think this should be
> marked as a duplicate of BUG 422401 -- currently we cannot handle keys not
> mapped in the keymap.

I dont think so. There are no keys in the output that start with `KEY_`, and key codes are only enumerated until 255, I dont see 372 there.

Can I fix it locally somehow?
I have attempted to use `xmodmap -e "keycode 372 = XF86FullScreen"` (as found [here](https://xkbcommon.org/doc/current/xkbcommon-keysyms_8h.html)), but the command just says "bad keysym name 'XF86FullScreen' in keysym list".
Also, according to the `wev` command, this key now produces keycode 380.. how did it change I dont know.
Comment 4 fanzhuyifan 2024-07-25 19:38:11 UTC
(In reply to mpeter.68m0y from comment #3)
> Can I fix it locally somehow?
> I have attempted to use `xmodmap -e "keycode 372 = XF86FullScreen"` (as
> found [here](https://xkbcommon.org/doc/current/xkbcommon-keysyms_8h.html)),
> but the command just says "bad keysym name 'XF86FullScreen' in keysym list".
> Also, according to the `wev` command, this key now produces keycode 380..
> how did it change I dont know.

Based on https://bugs.kde.org/show_bug.cgi?id=422401#c9, the following should work:

Pick a free keycode in the output of xmodmap (e.g., 103 in my case). Then, run `xmodmap -e "keycode 103 = XF86FullScreen"`.

*** This bug has been marked as a duplicate of bug 422401 ***
Comment 5 mpeter.68m0y 2024-07-25 20:16:08 UTC
(In reply to fanzhuyifan from comment #4)
> (In reply to mpeter.68m0y from comment #3)
> > Can I fix it locally somehow?
> > I have attempted to use `xmodmap -e "keycode 372 = XF86FullScreen"` (as
> > found [here](https://xkbcommon.org/doc/current/xkbcommon-keysyms_8h.html)),
> > but the command just says "bad keysym name 'XF86FullScreen' in keysym list".
> > Also, according to the `wev` command, this key now produces keycode 380..
> > how did it change I dont know.
> 
> Based on https://bugs.kde.org/show_bug.cgi?id=422401#c9, the following
> should work:
> 
> Pick a free keycode in the output of xmodmap (e.g., 103 in my case). Then,
> run `xmodmap -e "keycode 103 = XF86FullScreen"`.
> 
> *** This bug has been marked as a duplicate of bug 422401 ***

It prints the same error. Maybe my version (xmodmap 1.0.9) does not support this keysym?
Also, I don't know if `XF86FullScreen` is what I actually need to use, I just guessed it from the name that libinput told me (`KEY_FULL_SCREEN`). `wev` shows `sym: NoSymbol` and `key: 380` for pressing that key.
Comment 6 fanzhuyifan 2024-07-25 20:29:11 UTC
(In reply to mpeter.68m0y from comment #5)
> It prints the same error. Maybe my version (xmodmap 1.0.9) does not support
> this keysym?
> Also, I don't know if `XF86FullScreen` is what I actually need to use, I
> just guessed it from the name that libinput told me (`KEY_FULL_SCREEN`).
> `wev` shows `sym: NoSymbol` and `key: 380` for pressing that key.

XF86FullScreen was added to xorgproto 2 years ago to support KEY_FULL_SCREEN [0]. Maybe check your version of that? 

It seems xmodmap 1.0.9 was released on 2015-04-17 [1], which does seems a bit ancient..

[0] https://gitlab.freedesktop.org/xorg/proto/xorgproto/-/merge_requests/11
[1] https://xorg.freedesktop.org/archive/individual/app/
Comment 7 fanzhuyifan 2024-07-25 20:30:40 UTC
(In reply to fanzhuyifan from comment #6)
> XF86FullScreen was added to xorgproto 2 years ago to support KEY_FULL_SCREEN
> [0]. Maybe check your version of that? 

Sorry I mean 4 years ago.
Comment 8 mpeter.68m0y 2024-07-25 20:56:02 UTC
(In reply to fanzhuyifan from comment #6)
> XF86FullScreen was added to xorgproto 2 years ago to support KEY_FULL_SCREEN [0]. Maybe check your version of that? 

I dont seem to have such a package on opensuse Leap 15.5. This site also tells me that a package with such a name is only available for opensuse thumbleweed of the opensuse systems: https://repology.org/project/xorgproto/packages
When searching for installed packages with the proto name, I see a few X protocol extension packages, and xproto-devel which is 7.0.31-1.22.

I was not able to find a version number corresponding to the commit that added this, though. I have only found date-named git tags.

> It seems xmodmap 1.0.9 was released on 2015-04-17 [1], which does seems a
> bit ancient..

Such is life on opensuse leap. But maybe that is unusually old even here, though, thats 9 years.. My installation is from the end of 2022, so it cant be a long stuck package, weird.