When to use this skill
ALWAYS use this skill when the user mentions:
- Global hotkeys or keyboard shortcuts outside app focus
- Shortcut conflict detection and resolution
- Triggering app focus or commands via keyboard shortcuts
Trigger phrases include:
- "global shortcut", "hotkey", "keyboard shortcut", "keybinding", "accelerator"
How to use this skill
- Install the global-shortcut plugin:
cargo add tauri-plugin-global-shortcut - Register the plugin in your Tauri builder:
tauri::Builder::default() .plugin(tauri_plugin_global_shortcut::Builder::new().build()) - Configure capabilities in
src-tauri/capabilities/default.json:{ "permissions": ["global-shortcut:allow-register", "global-shortcut:allow-unregister"] } - Register shortcuts from the frontend:
import { register, unregister } from '@tauri-apps/plugin-global-shortcut'; await register('CommandOrControl+Shift+K', (event) => { if (event.state === 'Pressed') { console.log('Shortcut triggered!'); } }); - Handle conflicts by catching registration errors when another app holds the shortcut
- Unregister shortcuts on app exit to clean up system-level registrations
Outputs
- Global shortcut registration with conflict handling
- Shortcut-to-action routing pattern
- Cleanup on app exit
References
- https://v2.tauri.app/plugin/global-shortcut/
Keywords
tauri global shortcut, hotkey, keyboard shortcut, keybinding, accelerator