Principle:AI QL Tuui Global Shortcut Command Picker
| Knowledge Sources | |
|---|---|
| Domains | Command_Picker, Shortcuts, UX_Patterns |
| Last Updated | 2026-10-24 00:00 GMT |
Overview
A system-wide command picker pattern that uses a global keyboard shortcut to grab selected text from any application, present a popup prompt template selector, and route the selection to a chat interface.
Description
The Global Shortcut Command Picker pattern (inspired by macOS Spotlight and Alfred) enables instant access to AI-powered text transformations from any application. When the user presses the global shortcut (Ctrl+Alt+T), the system grabs the currently selected text via platform automation, caches it with a UUID, and opens a small frameless popup window at the cursor position showing a list of prompt templates. When the user selects a template, the popup closes, focus is returned to the source app, and the main window navigates to the chat route with the selected prompt and cached text injected. This pattern removes the friction of copying text, switching apps, and pasting.
Usage
Use this principle when building desktop applications that need system-wide text transformation or AI assistance accessible from any application via a keyboard shortcut.
Theoretical Basis
The command picker flow is a state machine:
IDLE → [Ctrl+Alt+T] → GRABBING → PICKER_OPEN → [Select] → ROUTING → CHAT → IDLE
↘ [No text] → NOTIFICATION → IDLE
States:
GRABBING: Automator.copySelectedText() → clipboard → cache with UUID
PICKER_OPEN: 300×320 frameless window at cursor with /popup route
ROUTING: Close popup → release focus → navigate main window to #/chat
CHAT: Send { prompt, input } to renderer via msgCommandSelectionInvoke
Key design properties:
- Global scope: Shortcut works regardless of focused application
- Text caching: UUID-keyed cache bridges the gap between text grab and chat injection
- Focus management: Source app focus is preserved and restored after popup close
- Popup positioning: Window appears at cursor, constrained to screen bounds
Related Pages
Implemented By
- Implementation:AI_QL_Tuui_Commander
- Implementation:AI_QL_Tuui_registerShortcuts
- Implementation:AI_QL_Tuui_Automation_grabSelectedText
- Implementation:AI_QL_Tuui_openCommandPicker
- Implementation:AI_QL_Tuui_aid_createWindow
- Implementation:AI_QL_Tuui_main_transfer_invoke
- Implementation:AI_QL_Tuui_IPCs
- Implementation:AI_QL_Tuui_renderer_ipc_facade
- Implementation:AI_QL_Tuui_preload_mcpServers