Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keylogger Mode for accepting Input when app is in background #11607

Open
erodozer opened this issue Jan 19, 2025 · 1 comment
Open

Keylogger Mode for accepting Input when app is in background #11607

erodozer opened this issue Jan 19, 2025 · 1 comment

Comments

@erodozer
Copy link

Describe the project you are working on

Software for streaming that intentionally runs in the background.

Describe the problem or limitation you are having in your project

Within Linux in particular, keypress inputs are handled by XKB, which only passes input when the Window is in focus. This prevents my software from activating certain features based on global hot keys when it is in the background.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

Global hot key combinations, or even media keys, are important to listen to for applications that should be able to operate without focus or minimized. By allowing for key input even when the application is in the background, it can allow for the development of richer, passive applications.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

Within Project Settings would be a toggle for Input to allow for a Keylogging mode, which enables input state to be tracked at all times instead of just while the Window is in focus. Input handling in scripts should not have to be changed. In cases where keylogging is enabled but some input should not be handled, users can explicitly add a check in their script to validate that the window has focus before handling the event. For security reasons it should not be enabled by default.

If this enhancement will not be used often, can it be worked around with a few lines of script?

No easily, as it requires implementing a different way of reading input from the system.

Is there a reason why this should be core and not an add-on in the asset library?

While it's possible to design as a native asset using GDExtension to read direct hardware input, it would involve bypassing Godot's core systems and break the patterns for handling input. It would be best to handle this in the platform setup for projects, so that it can be integrated and seamless for application development.

@AThousandShips
Copy link
Member

See also:

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

No branches or pull requests

2 participants