@tauri-apps/plugin-global-shortcut - v2.3.1
    Preparing search index...

    Function register

    • Register a global shortcut or a list of shortcuts.

      The handler is called when any of the registered shortcuts are pressed by the user.

      If the shortcut is already taken by another application, the handler will not be triggered. Make sure the shortcut is as unique as possible while still taking user experience into consideration.

      Parameters

      • shortcuts: string | string[]
      • handler: ShortcutHandler

        Shortcut handler callback - takes the triggered shortcut as argument

      Returns Promise<void>

      import { register } from '@tauri-apps/plugin-global-shortcut';

      // register a single hotkey
      await register('CommandOrControl+Shift+C', (event) => {
      if (event.state === "Pressed") {
      console.log('Shortcut triggered');
      }
      });

      // or register multiple hotkeys at once
      await register(['CommandOrControl+Shift+C', 'Alt+A'], (event) => {
      console.log(`Shortcut ${event.shortcut} triggered`);
      });

      2.0.0