Skip to content

ElectronGlobalShortcut

Unofficial

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

Import:

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

Signature:

export interface ElectronGlobalShortcut

Methods

Method Returns Description
isRegistered(accelerator) boolean Returns 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) boolean Registers 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) void Registers 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) void Unregisters the global shortcut of accelerator.
unregisterAll() void Unregisters all of the global shortcuts.

Links to this page: