Global Hotkeys & Shortcuts
Relevant source files
The following files were used as context for generating this wiki page:
Augenblick utilizes a robust keyboard-driven interface designed to support high-speed note-taking and management. The system integrates global keyboard listeners, Tauri-native menu accelerators, and context-aware guards to ensure shortcuts do not interfere with active text entry.
Sources: README.md, src/App.tsx:280-330
Architecture and Input Logic
The hotkey system is implemented through a combination of React-level event listeners and Tauri's native menu system. A central keydown handler, created via createPageKeydownHandler, serves as the primary dispatcher for keyboard events within the webview.
Input Guarding
To prevent accidental triggers while the user is typing, hotkeys are suppressed if the event target is an input, textarea, or an element with contenteditable='true'. This ensures that common characters like Delete or Backspace do not trigger destructive actions while the editor is focused.
Sources: plans/migration.inventory.md:310-315, src/App.tsx:280-285
Implementation Flow
The following diagram illustrates how a keyboard event is captured and routed to the appropriate application action.
The system checks the event target before executing logic to ensure user input in the editor is protected.
Sources: src/App.tsx:280-330, plans/migration.inventory.md:310-315
Primary Action Shortcuts
Most core application features are accessible via Cmd (macOS) or Ctrl (Windows/Linux) modifiers.
| Action | Shortcut | Implementation Function |
|---|---|---|
| New Note | ⌘N | notesStore.createNote() |
| Save | ⌘S | pageActions.saveCurrent() |
| Save As | ⇧⌘S | pageActions.saveAs() |
| Open/Import | ⌘O | pageActions.openMarkdown() |
| Pin/Unpin | ⌘P | notesStore.togglePin() |
| Move to Trash | Delete | pageActions.closeCurrent() |
| Command Palette | ⌘K | setShowCommandPalette() |
| Settings | ⌘, | setShowSettings(true) |
Sources: README.md:36-50, src/routes/pageActions.ts:56-83, src/App.tsx:285-310
Navigation and History Shortcuts
Shortcuts also facilitate list management and UI state changes, including reorder history via undo/redo stacks.
List Navigation
Users can move the current selection through the notes list using directional keys. In the "Notes" view, this cycles through pinned notes then unpinned notes; in the "Trash" view, it cycles through the trashed list.
- Move Selection Up:
⌘⇧↑(Cmd/Ctrl + Shift + ArrowUp) - Move Selection Down:
⌘⇧↓(Cmd/Ctrl + Shift + ArrowDown)
Sources: plans/migration.inventory.md:300-305, src/App.tsx:310-315
Reorder History
The notesStore maintains independent undo/redo stacks for reordering operations with a maximum depth of 20 entries.
This sequence shows the stack manipulation that occurs during a reorder undo action.
Sources: src/stores/notesStore.ts:404-435, src/App.tsx:315-325
Tauri Native Integration
Augenblick synchronizes webview-based hotkeys with native OS menus to ensure consistent behavior across the application. Tauri listeners are registered to handle events emitted from the native menu bar.
Menu-to-Hotkey Mapping
Native menu items are mapped to the same internal actions as the global keyboard listener.
- menu-new-note: Triggers
notesStore.createNote() - menu-save: Triggers
pageActions.saveCurrent() - menu-trash: Triggers
pageActions.closeCurrent() - menu-settings: Opens the Settings dialog UI
Sources: src/App.tsx:210-235, plans/migration.inventory.md:330-345
Conclusion
The Global Hotkey system is a critical component of Augenblick's ADHD-friendly design, enabling users to manage the lifecycle of temporary notes without relying on mouse interactions. By combining native accelerators with custom React logic, the application maintains responsiveness and data integrity across different operating modes.