Documentation Index
Fetch the complete documentation index at: https://mintlify.com/LiveSplit/livesplit-core/llms.txt
Use this file to discover all available pages before exploring further.
HotkeySystem registers global keyboard shortcuts that fire even when your application window does not have focus. It works across Windows, macOS, Linux, and the web (via the wasm-web feature). On platforms that do not support global hotkeys, the system compiles and runs without error but never receives any key events — it is a safe no-op.
HotkeyConfig
HotkeyConfig maps timer actions to optional hotkeys. Each field is Option<Hotkey> — set it to None to disable that action.
| Field | Default | Description |
|---|---|---|
split | Numpad1 | Split the current segment (also starts a new attempt). |
reset | Numpad3 | Reset the current attempt. |
undo | Numpad8 | Undo the last split. |
skip | Numpad2 | Skip the current split without recording a time. |
pause | Numpad5 | Pause the current attempt (can also start a new attempt). |
undo_all_pauses | None | Remove all accumulated pause time from the current time. |
previous_comparison | Numpad4 | Switch to the previous comparison. |
next_comparison | Numpad6 | Switch to the next comparison. |
toggle_timing_method | None | Toggle between Real Time and Game Time. |
Copy, Clone, and serializable via serde. You can persist the user’s configuration as JSON:
Creating a HotkeySystem
HotkeySystem is generic over the CommandSink it sends timer commands to. In most setups you use a SharedTimer wrapped in livesplit-core’s CommandSink.
Default Hotkeys
Custom Hotkeys
Each hotkey must be unique across all actions in a config.
HotkeySystem::with_config and set_config will return an error if the same key is assigned to multiple actions.Activating and Deactivating
The hotkey system is active by default after construction. You can temporarily suspend it — for example while a rebinding dialog is open — and resume it afterwards:Updating the Configuration at Runtime
The configuration can be replaced without recreating the system:Key Resolution
On platforms where the keyboard layout affects key names (e.g. an AZERTY layout renamesKeyQ to the physical A position), you can resolve a KeyCode to its layout-specific label:
C API
Web: Listening on Additional Windows
When running in the browser (targetwasm32-unknown-unknown with the wasm-web feature), you can forward key events from child windows or iframes to the same hotkey system:
How CommandSink Works
HotkeySystem does not hold a direct reference to a Timer. Instead it holds a CommandSink — a lightweight, cloneable handle that queues timer commands (start, split, reset, etc.). The runtime drains the queue and applies the commands to the timer. This decoupling means hotkey events from a background thread never need to lock the timer directly.