HotkeyCallback
Electron APIs / Overlay / HotkeyCallback
type HotkeyCallback = (hotKey: IOverlayHotkey, state: HotkeyState) => void;
Callback for handling hotkey events.
Triggered when a registered overlay hotkey is pressed or released.
Parameters
Parameter | Type | Description |
---|---|---|
hotKey | IOverlayHotkey | The hotkey object containing key code, modifiers, and metadata. |
state | HotkeyState | The current state of the hotkey (pressed or released ). |
Returns
void
Example
const onHotkey: HotkeyCallback = (hotKey, state) => {
if (state === "pressed" && hotKey.name === "screenshot") {
captureScreenshot();
}
};