Skip to content

hotkey

Reads a Hotkey from a key press and formats one for display.

Interface Description
FormatHotkeyParams Parameters of formatHotkey.
GetHotkeyFromKeyboardEventParams Parameters of getHotkeyFromKeyboardEvent.
Function Description
formatHotkey Formats a hotkey the way Obsidian’s hotkey settings show it: Ctrl + Shift + P, or ⌘⇧P on macOS.
getHotkeyFromKeyboardEvent Reads the hotkey a key press makes, in the shape Obsidian stores in hotkeys.json. The Ctrl key reads as Mod everywhere but macOS, and the Command key as Mod on macOS. Letters and digits come from the physical key, so Shift or a keyboard layout does not change them.
isSameHotkey Checks whether two hotkeys are the same key combination, whatever order their modifiers are listed in.