Use the following modifiers in your key combinations:
CommandOrControl - Command on macOS, Control on Windows/Linux
Command or Cmd - macOS only
Control or Ctrl - Control key
Alt or Option - Alt key
Shift - Shift key
Super - Windows key on Windows/Linux
Example key combinations:
// Cross-platform shortcutsGlobalShortcut::key('CommandOrControl+Q')->event('app.quit')->register();GlobalShortcut::key('CommandOrControl+N')->event('window.new')->register();GlobalShortcut::key('CommandOrControl+Shift+P')->event('command.palette')->register();// Function keysGlobalShortcut::key('F12')->event('devtools.toggle')->register();// Letter keysGlobalShortcut::key('CommandOrControl+K')->event('search.focus')->register();
Use CommandOrControl instead of Command or Control to ensure your shortcuts work across all platforms.
macOS: Some shortcuts may be reserved by the system
Windows: Windows key combinations may conflict with system shortcuts
Linux: Behavior may vary depending on the desktop environment
Global shortcuts can conflict with system shortcuts or other applications. Always use modifier combinations and provide a way for users to customize or disable shortcuts.
If a shortcut is already registered by another application, the registration will fail silently. Consider providing feedback to users if critical shortcuts cannot be registered.