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
Add support for registering global keyboard shortcut bindings #1919
Comments
This needs to be implemented on a per-platform basis, hence the
Isn't that achieved by Alt + Tab? 🙂 The current F5 and F8 shortcuts work while the project is focused because they're defined both in the editor and the running project. (Of course, this default assignment no longer applies if the project isn't being run from the editor.)
Modules require recompiling the editor (and all export templates you plan to use), but GDNative add-ons don't require recompiling the editor and export templates. |
Only if the app was the last thing used. The idea is keep the user in the mental context of the game or task. Using a the OS task switcher has become a task in and of itself and requires quite a bit of thought when multiple windows is used. Or maybe it's because I spend to much time in MacOS which has a completely worthless
I didn't realize those where options, however, the mac I use doesn't have function keys either so those still don't help with the latest mac laptops. Edited: fixed a typo |
This could also be great for other kinds of desktop apps like time-trackers, command palletes, social media apps (like discord) or even desktop-integrated games, where it runs in an always-on-top transparent window with mouse passthrough. |
I would like to +1 this feature. I am in the middle of building a Godot-based app that will need to make use of global hotkeys to perform certain functions while the window is in the background. Sadly that doesn't seem currently possible so I'm looking into if a C++ module or something can get around this limitation. |
@ByteSizeOtter Were you able to find a module for this? I also am looking in to creating an application that depends on events triggered by hotkeys. Specifically when the window is out of focus. I do know that this needs to be done on an operating system level. |
@CarbsCode Not as of yet (project is currently on hold). I had done a bit of research on this though and it can be messy to implement. Windows, Linux, and macOS all do hotkey hooks differently. There's some software packages out there including a couple of Rust crates that claim to have cross-platform implementations of global hotkeys, but I have not looked too deeply into nor tested any of them. |
@CavemanIke might not be a complete solution for what you guys are looking for, but I managed to do it for Windows on a personal timer project through C# using this library I found called GlobalHotKeys. I'm pretty sure you could also try doing the same for other platforms if you can find libraries that support them (or try and code the low level implementation yourself if you really need to). |
Describe the project you are working on
Simple Note taking app using the rich text input node.
Describe the problem or limitation you are having in your project
I would like to show/hide the app with a global keyboard shortcut in the vein of iterm for mac or guake for linux.
Describe the feature / enhancement and how it helps to overcome the problem or limitation
My current use-case is to allow my note taking app to be hidden/shown at will. This will allow the taking of notes at will regardless of context.
For the current Godot GUI/Editor it would be nice to be able to press a button while in game and refocus on the editor to manipulate node properties and refocus off the editor at will.
On the games side, I could imagine a scavenger hunt game where one needs to do things outside the game context, such as a google image search or a wikipedia search and return to the game with a quick keyboard command. To pitch this further, imaging a game as a training tool where one needs to accomplish tasks outside of the game to complete the game. They could use something simple like CMD+ESC to return to the game.
Think of a game such as Minecraft or Terriana, where one is constantly referring to out of game resources to know the crafting recipes. Being able to switch to/from the game context would be very handy and help to not break the flow of the game.
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
Allow input maps to be marked as global. I envision this would just be a checkbox on the editor pane for input maps.
If this enhancement will not be used often, can it be worked around with a few lines of script?
I asked this question over at the Godot QA site to see if there was a way to do it in the engine and I was referred here to propose the change.
https://godotengine.org/qa/88821/how-to-create-os-level-hot-key-bindings
Is there a reason why this should be core and not an add-on in the asset library?
I am not failure enough with either to make that call. I don't think this could be done with an add-on. Maybe a module, unless I am mistaken, modules require recompiling the editor to enable.
The text was updated successfully, but these errors were encountered: