Cap icon indicating copy to clipboard operation
Cap copied to clipboard

[Feature Request]: Display keyboard shortcuts inside the Menubar dropdown menu

Open dennyschroeder opened this issue 6 months ago • 3 comments

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)

Image

dennyschroeder avatar May 21 '26 16:05 dennyschroeder

CAP-716

linear[bot] avatar May 21 '26 16:05 linear[bot]

For context on implementation, the relevant code lives in:

  • Tray menu construction: apps/desktop/src-tauri/src/tray.rs - the build_tray_menu() function (around line 381) creates menu items using MenuItem::with_id(). Currently the last parameter is None::<&str> for the accelerator text.

  • Hotkey storage: apps/desktop/src-tauri/src/hotkeys.rs - the HotkeysStore struct holds the mapping of HotkeyAction to Hotkey (with code, meta, ctrl, alt, shift fields). This is persisted via tauri_plugin_store.

The tray menu items map fairly directly to hotkey actions, for example:

  • TrayItem::RecordDisplay / TrayItem::RecordWindow / TrayItem::RecordArea correspond to HotkeyAction::OpenRecordingPickerDisplay / Window / Area
  • TrayItem::TakeScreenshot maps to screenshot actions like ScreenshotDisplay, etc.

To display shortcuts, the approach would be:

  1. Fetch the HotkeysStore from state in build_tray_menu()
  2. Add a helper function to convert a Hotkey to macOS-style symbol text (e.g., ⌘⇧S)
  3. 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.

tembo[bot] avatar May 21 '26 16:05 tembo[bot]

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.

richiemcilroy avatar Nov 04 '26 16:11 richiemcilroy