[Feature Request]: Display keyboard shortcuts inside the Menubar dropdown menu
Hi @richiemcilroy,
To improve the user experience and help users memorize active keybindings faster, it would be great to display the configured keyboard shortcuts directly inside the macOS Menubar dropdown menu.
Current Behavior: The dropdown list shows the actions (e.g., "Screenshot Display", "Screenshot Window", "Screenshot Area") but gives no visual indication of the assigned shortcuts.
Proposed Solution:
Display the corresponding hotkey symbols (e.g., ⌘⇧S, ⌘⇧C, ⌘⇧Z) aligned to the right side of each menu item, following native macOS design guidelines. If a shortcut is changed in the settings, the menu text should update dynamically.
(Attached a screenshot of the current menu state below)
For context on implementation, the relevant code lives in:
-
Tray menu construction:
apps/desktop/src-tauri/src/tray.rs- thebuild_tray_menu()function (around line 381) creates menu items usingMenuItem::with_id(). Currently the last parameter isNone::<&str>for the accelerator text. -
Hotkey storage:
apps/desktop/src-tauri/src/hotkeys.rs- theHotkeysStorestruct holds the mapping ofHotkeyActiontoHotkey(withcode,meta,ctrl,alt,shiftfields). This is persisted viatauri_plugin_store.
The tray menu items map fairly directly to hotkey actions, for example:
TrayItem::RecordDisplay/TrayItem::RecordWindow/TrayItem::RecordAreacorrespond toHotkeyAction::OpenRecordingPickerDisplay/Window/AreaTrayItem::TakeScreenshotmaps to screenshot actions likeScreenshotDisplay, etc.
To display shortcuts, the approach would be:
- Fetch the
HotkeysStorefrom state inbuild_tray_menu() - Add a helper function to convert a
Hotkeyto macOS-style symbol text (e.g.,⌘⇧S) - Append the shortcut text to the menu item labels
For dynamic updates when shortcuts change, the set_hotkey command in hotkeys.rs (line 254) would need to call refresh_tray_menu() after updating a hotkey - that function already exists for updating the "Previous" items submenu.
There's also an older issue #102 discussing tray menu enhancements that might have related context.
Thanks! The menu bar menu now shows each action's shortcut next to it and updates when you change one. This shipped in 0.6.2, so closing.