HotkeyManager
Properties
app
app:
App
Reference to App
bakedHotkeys
bakedHotkeys:
KeymapInfo
[]
Assigned hotkeys
bakedIds
bakedIds:
string
[]
Array of hotkey index to command ID
customKeys
customKeys:
HotkeyManagerCustomKeysRecord
Custom (non-Obsidian default) hotkeys, one to many mapping of command ID to assigned hotkey
defaultKeys
defaultKeys:
HotkeyManagerDefaultKeysRecord
Default hotkeys, one to many mapping of command ID to assigned hotkey
Methods
addDefaultHotkeys()
addDefaultHotkeys(
command
,keys
):void
Add a hotkey to the default hotkeys
Parameters
• command: string
Command ID to add hotkey to
• keys: KeymapInfo
[]
Hotkeys to add
Returns
void
getDefaultHotkeys()
getDefaultHotkeys(
command
):KeymapInfo
[]
Get hotkey associated with command ID
Parameters
• command: string
Command ID to get hotkey for
Returns
getHotkeys()
getHotkeys(
command
):KeymapInfo
[]
Get hotkey associated with command ID
Parameters
• command: string
Command ID to get hotkey for
Returns
onTrigger()
onTrigger(
event
,keypress
):boolean
Trigger a command by keyboard event
Parameters
• event: KeyboardEvent
Keyboard event to trigger command with
• keypress: KeymapInfo
Pressed key information
Returns
boolean
printHotkeyForCommand()
printHotkeyForCommand(
commandId
):string
Pretty-print hotkey of a command
Parameters
• commandId: string
Command ID to print hotkey for
Returns
string
removeDefaultHotkeys()
removeDefaultHotkeys(
command
):void
Remove a hotkey from the default hotkeys
Parameters
• command: string
Command ID to remove hotkey from
Returns
void
removeHotkeys()
removeHotkeys(
command
):void
Remove a hotkey from the custom hotkeys
Parameters
• command: string
Command ID to remove hotkey from
Returns
void
setHotkeys()
setHotkeys(
command
,keys
):void
Add a hotkey to the custom hotkeys (overrides default hotkeys)
Parameters
• command: string
Command ID to add hotkey to
• keys: KeymapInfo
[]
Hotkeys to add
Returns
void