-
Notifications
You must be signed in to change notification settings - Fork 19
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
Detecting repeat key presses when the user is holding down a key? #59
Comments
It should be possible on Linux and Windows but idk about macOS, there is a lack of documentation around the APIs, the only thing I could find is https://github.com/planetbeing/xpwn/blob/ac362d4ffe4d0489a26144a1483ebf3b431da899/idevice/QuicktimeSDK/CIncludes/CarbonEvents.h#L943-L951 and it doesn't seem possible. What is your use-case for repeated events? I believe you can simulate the repeated keys by looping until a released event. |
Apologies for the late reply and thanks for your help. This does seem to work quite easily on Windows as you mention but indeed I have never tried such a thing on macOS. In my case, I am registering a global hotkey for controlling the volume of an audio interface using the volume up/down keys. As you can imagine, much like Windows' native volume control, it is very common to hold volume up or down to reach the desired volume. Presently I'm using the native Windows API calls myself but would love to use your cross-platform implementation. |
We can add repeating behind a feature flag or an option on the |
On Windows, this can be configured via the OS itself: So I think it optimally would be configurable for OSs that don't support it natively. What do you think? Cheers |
I've revisited this tonight, and while you can kinda fake this, it's not ideal. As shown above, there are settings at the OS both for the delay before repeats, and then the frequency. You can test this on Windows yourself by say, holding down the volume up or down keys while listening to music. There's an initial delay, and then the volume changes based on the frequency you've configured continually until the key is released. The repeats show up as events in the event loop after a call to Cheers |
Hey folks, hope you're doing well.
At present, if a user holds down a global hotkey, this library emits a single event with state
Pressed
, and when the user releases the key, a single event with 'Released' is emitted. Tested on Windows 11 Pro.However, in many cases, users may hold down a hotkey and expect it to continue firing at the rate set by the OS. Would it be possible to at least have a way to enable this behaviour please?
Thanks heaps
Fotis
The text was updated successfully, but these errors were encountered: