Any way to get godot to look for input when the game window isn't focused?

Godot Version

4.5

Question

Hi! Trying to add hotkeys to what I’m working on. By hotkeys i mean the window still checking input when its not focused. I’m pretty sure it can do it with both a mouse and controller but its the keyboard I’m having trouble with. I’ve found a few threads about this that are a few years old that say its not possible in godot and I figured I would ask again since its been a few versions and the engine may have been updated to allow for this possibility. So if anyone has any information on how I can get godot to register keyboard strokes when not focused I’d be super happy. Thanks!

1 Like

I don’t believe there is currently a way to do that, no. With the exception of very niche games, the only reason for a feature like that is creating applications (and keyloggers), which although possible, Godot is still a game engine first.

Something like that might get added if enough people start creating apps with Godot and ask for it, but even when talking about apps, most of them won’t need to listen for input when unfocused.

So you can either design around it by, for example, creating a borderless, unresizable, always on top, transparent window that will serve as an overlay when the app is minimized (think little red circle in the corner of the screen when screen recording), that will allow users to click it in order to do something in the app (it still won’t get key inputs when unfocused). Or you can extend the engine yourself/make a GDExtension and add what you need for the target platforms (it most likely works differently on every platform).