Rust Hotkey
A library to listen to global hotkeys in Rust
How to use
See the examples folder for how to use this library.
OS Support
This lib aims to be cross platform. The currently supported platforms are:
- Windows
- Linux (X11)
Category: Rust / System tools |
Watchers: 1 |
Star: 47 |
Fork: 7 |
Last update: May 23, 2023 |
A library to listen to global hotkeys in Rust
See the examples folder for how to use this library.
This lib aims to be cross platform. The currently supported platforms are:
Pull requests consist of the following changes:
u32
to i32
to stay consistant with winapi
constant's typelisten
method modified to interupt infinite loop when WM_QUIT
message receivedpost_quit_message
helper function that simply calls PostQuitMessage
that sends WM_QUIT
listen
and post_quit_message
From PostQuitMessage
docs:
Indicates to the system that a thread has made a request to terminate (quit).
I have verified that posting WM_QUIT
by calling PostQuitMessage
message from different process have no effect on the listen
loop.
There are a couple places in the code where you do something along the lines of
let mut event: SomeType = mem::MaybeUninit::uninit().assume_init();
This is immediately undefined behavior, regardless of the type. The 2 scenarios I have seen this in the codebase are in the context of a C-style return parameter, so the fix is rather simple.
let mut event: MaybeUninit<SomeType> = mem::MaybeUninit::uninit();
// Maybe attempt to handle a potential int-code error this function may return?
get_event(event.as_mut_ptr());
let event: SomeType = event.assume_init();
Hello, do you plan on adding documentation to this software? Thanks in advance.
Is this library still maintained? There's some forks with macOS support (https://github.com/gamebooster/soundboard/blob/master/extern/hotkey-rs/src/macos.rs) but I didn't test it yet. Would you accept a PR with that?
hi, i'm using
and it's not work. also i don't have any error. tested on :
but it's ok on windows.