Skip to content

ElectronGlobalShortcut

Unofficial

Detects keyboard events when the application does not have keyboard focus.

Import:

import type { ElectronGlobalShortcut } from '@obsidian-typings/obsidian-catalyst-latest';

Signature:

export interface ElectronGlobalShortcut

Methods

MethodReturnsDescription
isRegistered(accelerator)booleanReturns whether this application has registered accelerator.

When the accelerator is already taken by other applications, this call will still return false. This behavior is intended by operating systems, since they don't want applications to fight for global shortcuts.
register(accelerator, callback)booleanRegisters a global shortcut of accelerator. The callback is called when the registered shortcut is pressed by the user.

When the accelerator is already taken by other applications, this call will silently fail.
registerAll(accelerators, callback)voidRegisters a global shortcut of all accelerator items in accelerators. The callback is called when any of the registered shortcuts are pressed by the user.

When a given accelerator is already taken by other applications, this call will silently fail.
unregister(accelerator)voidUnregisters the global shortcut of accelerator.
unregisterAll()voidUnregisters all of the global shortcuts.

Links to this page: