Skip to content

SDLBackend: do not leak Super+KEY shortcuts to DE#2157

Open
pchome wants to merge 1 commit into
ValveSoftware:masterfrom
pchome:shortcut-grab
Open

SDLBackend: do not leak Super+KEY shortcuts to DE#2157
pchome wants to merge 1 commit into
ValveSoftware:masterfrom
pchome:shortcut-grab

Conversation

@pchome
Copy link
Copy Markdown

@pchome pchome commented May 1, 2026

Some gamescope shortcuts are DE default shortcuts.

For example Super+I is KDE Plasma Settings shortcut, and Super+B is Power Profile Switch in Plasma Power Management.

Funny enough Super+G is the default shortcut too, but keyboard grab seems resets the key modifier (?) so it not detected by DE. Also user must press the Super key again after that for other gamescope shorts to work.

Maybe a bit hackky solution is to temporary grab keyboard (if not already grabbed) while the Super key remain pressed and release grab when the key released.

During the key grab we lose key modifier (as was mentioned above), so the same toggle-variable used as alternative modifier indicator.

NOTE: DE will not receive Super+KEY shortcuts in this case. If there were some important ones for users (e.g. Super+PrintScreen).

Closes: #2156

Some gamescope shortcuts are DE default shortcuts.

For example `Super+I` is KDE Plasma Settings shortcut, and `Super+B` is
Power Profile Switch in Plasma Power Management.

Funny enough `Super+G` is the default shortcut too, but keyboard grab
seems resets the key modifier (?) so it not detected by DE. Also user
must press the Super key again after that for other gamescope shorts
to work.

Maybe a bit hackky solution is to temporary grab keyboard (if not
already grabbed) while the Super key remain pressed and release grab
when the key released.

During the key grab we lose key modifier (as was mentioned above), so
the same toggle-variable used as alternative modifier indicator.

NOTE: DE will not receive Super+KEY shortcuts in this case. If there
were some important ones for users (e.g. Super+PrintScreen).

Issue: ValveSoftware#2156
@pchome
Copy link
Copy Markdown
Author

pchome commented May 1, 2026

To debug SDL events use SDL_EVENT_LOGGING=1 (or =2 for more events).
For example SDL_EVENT_LOGGING=1 gamescope -F fsr -- vkgears

...
SDL EVENT: SDL_EVENT_KEY_DOWN (timestamp=5926131533 windowid=2 which=0 state=pressed repeat=false scancode=227 keycode=1073742051 mod=0x400)
SDL EVENT: SDL_EVENT_KEY_UP (timestamp=6190009554 windowid=2 which=0 state=released repeat=false scancode=227 keycode=1073742051 mod=0x0)
...

@awsms
Copy link
Copy Markdown

awsms commented May 6, 2026

Would be better to have user-defined keybinds than stealing a key globally.
This would just mean breaking any system-defined keybinds because gamescope cares so much about hardcoding keybinds..

@pchome
Copy link
Copy Markdown
Author

pchome commented May 6, 2026

Yeah, I guess.
Using this patch for a while and there are some cases where it not work as expected.
For example Super (Meta in KDE interpretation) is the shortcut itself (for Application Launcher). If something stealing focus while Super key is pressed then on key release system receives KEY_UP and opens menu.

So this solution is rather bad, PR can be closed if no other plans.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

FYI: Meta+I is a default shortcut for SystemSettings in Plasma 6.6.x

2 participants