How to get all KeyPresses globally?

A component only receives KeyPresses when it is in focus.

Is there a way to set up a component to receive ALL keypresses, no matter which component is actually currently focused?

Imagine a “KeyLogger” sort of application.

The Desktop has methods like Desktop::addFocusChangeListener() and Desktop::addGlobalMouseListener(), but I see nothing similar for KeyPresses. Maybe I’m missing something obvious…

1 Like

I’ve been digging into how to detect key releases recently.
You can access the set of keys that are currently down in the public NSViewComponentPeer::keysCurrentlyDown static class member std::set on MacOS.

juce::KeyPress::isKeyCurrentlyDown ?