diff --git a/.changes/docs.md b/.changes/docs.md new file mode 100644 index 0000000..e60e745 --- /dev/null +++ b/.changes/docs.md @@ -0,0 +1,5 @@ +--- +"global-hotkey": "patch" +--- + +Update docs diff --git a/README.md b/README.md index 16021f8..b276a5f 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,16 @@ global_hotkey lets you register Global HotKeys for Desktop Applications. +## Platforms-supported: + +- Windows +- macOS +- Linux (X11 Only) + +## Platform-specific notes: + +- On Windows a win32 event loop must be running on the thread. It doesn't need to be the main thread but you have to create the global hotkey manager on the same thread as the event loop. +- On macOS, an event loop must be running on the main thread so you also need to create the global hotkey manager on the main thread. + ## Example ```rs @@ -15,10 +26,10 @@ let hotkey = HotKey::new(Some(Modifiers::SHIFT), Code::KeyD); manager.register(hotkey); ``` - ## Processing global hotkey events You can also listen for the menu events using `GlobalHotKeyEvent::receiver` to get events for the hotkey pressed events. + ```rs use global_hotkey::GlobalHotKeyEvent; @@ -27,12 +38,6 @@ if let Ok(event) = GlobalHotKeyEvent::receiver().try_recv() { } ``` -## Platforms-supported: - -- Windows -- macOS -- Linux (X11 Only) - ## License Apache-2.0/MIT diff --git a/examples/tao.rs b/examples/tao.rs index 886f024..1982d7e 100644 --- a/examples/tao.rs +++ b/examples/tao.rs @@ -27,7 +27,7 @@ fn main() { *control_flow = ControlFlow::Poll; if let Ok(event) = global_hotkey_channel.try_recv() { - println!("{:?}", event); + println!("{event:?}"); if hotkey2.id() == event.id { hotkeys_manager.unregister(hotkey2).unwrap(); diff --git a/examples/winit.rs b/examples/winit.rs index 534d547..7aa1b3d 100644 --- a/examples/winit.rs +++ b/examples/winit.rs @@ -27,7 +27,7 @@ fn main() { *control_flow = ControlFlow::Poll; if let Ok(event) = global_hotkey_channel.try_recv() { - println!("{:?}", event); + println!("{event:?}"); if hotkey2.id() == event.id { hotkeys_manager.unregister(hotkey2).unwrap(); diff --git a/src/lib.rs b/src/lib.rs index 4c7d6e6..22773e4 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -2,8 +2,21 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT +#![allow(clippy::uninlined_format_args)] + //! global_hotkey lets you register Global HotKeys for Desktop Applications. //! +//! ## Platforms-supported: +//! +//! - Windows +//! - macOS +//! - Linux (X11 Only) +//! +//! ## Platform-specific notes: +//! +//! - On Windows a win32 event loop must be running on the thread. It doesn't need to be the main thread but you have to create the global hotkey manager on the same thread as the event loop. +//! - On macOS, an event loop must be running on the main thread so you also need to create the global hotkey manager on the main thread. +//! //! # Example //! //! ```no_run