pub struct HotkeyManager<T> { /* private fields */ }Implementations§
Source§impl<T> HotkeyManager<T>
impl<T> HotkeyManager<T>
Sourcepub fn set_no_repeat(&mut self, no_repeat: bool)
pub fn set_no_repeat(&mut self, no_repeat: bool)
Enable or disable the automatically applied ModKey::NoRepeat modifier. By default, this
option is set to true which causes all hotkey registration calls to add the NoRepeat
modifier, thereby disabling automatic retriggers of hotkeys when holding down the keys.
When this option is disabled, the ModKey::NoRepeat can still be manually added while
registering hotkeys.
Note: Setting this flag doesn’t change previously registered hotkeys. It only applies to registrations performed after calling this function.
Trait Implementations§
Source§impl<T: Debug> Debug for HotkeyManager<T>
impl<T: Debug> Debug for HotkeyManager<T>
Source§impl<T> Default for HotkeyManager<T>
impl<T> Default for HotkeyManager<T>
Source§impl<T> Drop for HotkeyManager<T>
impl<T> Drop for HotkeyManager<T>
Source§impl<T> HotkeyManagerImpl<T> for HotkeyManager<T>
impl<T> HotkeyManagerImpl<T> for HotkeyManager<T>
fn new() -> HotkeyManager<T>
Source§fn register_extrakeys(
&mut self,
virtual_key: VirtualKey,
modifiers_key: Option<&[ModifiersKey]>,
extra_keys: Option<&[VirtualKey]>,
callback: Option<impl Fn() -> T + Send + 'static>,
) -> Result<HotkeyId, HotkeyError>
fn register_extrakeys( &mut self, virtual_key: VirtualKey, modifiers_key: Option<&[ModifiersKey]>, extra_keys: Option<&[VirtualKey]>, callback: Option<impl Fn() -> T + Send + 'static>, ) -> Result<HotkeyId, HotkeyError>
Register a new hotkey with additional required extra keys. Read more
Source§fn register(
&mut self,
virtual_key: VirtualKey,
modifiers_key: Option<&[ModifiersKey]>,
callback: Option<impl Fn() -> T + Send + 'static>,
) -> Result<HotkeyId, HotkeyError>
fn register( &mut self, virtual_key: VirtualKey, modifiers_key: Option<&[ModifiersKey]>, callback: Option<impl Fn() -> T + Send + 'static>, ) -> Result<HotkeyId, HotkeyError>
Same as
register_extrakeys but without extra keys. Read moreSource§fn unregister(&mut self, id: HotkeyId) -> Result<(), HotkeyError>
fn unregister(&mut self, id: HotkeyId) -> Result<(), HotkeyError>
Unregister a hotkey. This will prevent the hotkey from being triggered in the future. Read more
Source§fn unregister_all(&mut self) -> Result<(), HotkeyError>
fn unregister_all(&mut self) -> Result<(), HotkeyError>
Unregister all registered hotkeys. This will be called automatically when dropping the
HotkeyManager instance. Read more
Source§fn handle_hotkey(&self) -> Option<T>
fn handle_hotkey(&self) -> Option<T>
Wait for a single a hotkey event and execute the callback if all keys match. This returns
the callback result if it was not interrupted. The function call will block until a hotkey
is triggered or it is interrupted. Read more
Source§fn event_loop(&self)
fn event_loop(&self)
Run the event loop, listening for hotkeys. This will run indefinitely until interrupted and
execute any hotkeys registered before.
Source§fn interrupt_handle(&self) -> InterruptHandle
fn interrupt_handle(&self) -> InterruptHandle
Get an
InterruptHandle for this HotkeyManager that can be used to interrupt the event
loop.impl<T> Send for HotkeyManager<T>
impl<T> Sync for HotkeyManager<T>
Auto Trait Implementations§
impl<T> Freeze for HotkeyManager<T>
impl<T> !RefUnwindSafe for HotkeyManager<T>
impl<T> Unpin for HotkeyManager<T>
impl<T> !UnwindSafe for HotkeyManager<T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more