Skip to main content

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​

ParameterTypeDescription
hotKeyIOverlayHotkeyThe hotkey object containing key code, modifiers, and metadata.
stateHotkeyStateThe current state of the hotkey (pressed or released).

Returns​

void

Example​

const onHotkey: HotkeyCallback = (hotKey, state) => {
if (state === "pressed" && hotKey.name === "screenshot") {
captureScreenshot();
}
};