Skip to content

✨ feat: Cmd-hold shortcut hints for toolbar & sidebar footer#63

Merged
vaayne merged 7 commits intomainfrom
feat/toolbar-shortcut-hints
Apr 13, 2026
Merged

✨ feat: Cmd-hold shortcut hints for toolbar & sidebar footer#63
vaayne merged 7 commits intomainfrom
feat/toolbar-shortcut-hints

Conversation

@vaayne
Copy link
Copy Markdown
Owner

@vaayne vaayne commented Apr 13, 2026

Summary

Add shortcut hint pills to toolbar buttons and sidebar footer when long-pressing ⌘, matching the existing sidebar row hint behavior.

Toolbar

  • All 5 toolbar buttons (Toggle Sidebar, Files, Git, Split Right, Split Down) show shortcut pills on Cmd hold
  • Custom NSButton views via item.view for reliable view ownership
  • Pills overlaid on themeFrame using frame-based coordinate conversion
  • Data-driven ToolbarItemDef array replaces repetitive switch/action boilerplate

Sidebar Footer

  • Added ⇧⌘O shortcut hint to the Open Project button
  • Unified button label from "Add Repository" to "Open Project" (same underlying action)

Fixes

  • Fixed sidebar tooltip from incorrect ⌘0 to actual default ⌘B
  • Added shortcut hints to split button tooltips (⌘D, ⇧⌘D)
  • Unified all toolbar icon sizes to consistent 13pt
  • Updated en + zh-Hans localization strings

vaayne and others added 7 commits April 13, 2026 22:20
…tons

- Overlay ShortcutHintPill on all 5 toolbar buttons (Toggle Sidebar ⌘B,
  Files ⌘E, Git ⌘G, Split Right ⌘D, Split Down ⇧⌘D) via
  ShortcutHintModifierMonitor + Combine subscription
- Add ⇧⌘O shortcut hint to sidebar footer Open Project button
- Unify footer button label from 'Add Repository' to 'Open Project'
  (same underlying action: showAddProjectPanel)
- Fix sidebar tooltip from incorrect ⌘0 to actual default ⌘B
- Add shortcut hints to split button tooltips
- Update en + zh-Hans localization strings

Amp-Thread-ID: https://ampcode.com/threads/T-019d872d-c86f-72fb-af91-81864d8eaaef
Co-authored-by: Amp <amp@ampcode.com>
All 5 toolbar buttons now use the same NSImage.SymbolConfiguration
(pointSize: 13). Previously sidebar/files/git used the default size
while split right/down were set to 11pt.

Amp-Thread-ID: https://ampcode.com/threads/T-019d872d-c86f-72fb-af91-81864d8eaaef
Co-authored-by: Amp <amp@ampcode.com>
The previous approach used item.value(forKey: "view") which returns
nil for image-based NSToolbarItems. Now walks the window's view
hierarchy to find toolbar button views by matching their identifier,
and overlays pills on the superview so they render above the buttons.

Amp-Thread-ID: https://ampcode.com/threads/T-019d872d-c86f-72fb-af91-81864d8eaaef
Co-authored-by: Amp <amp@ampcode.com>
Rewrote toolbar item creation to use custom NSButton views via
item.view instead of image-based items. This gives us direct
references to the button views. Pills are now overlaid on themeFrame
(the titlebar container) using coordinate conversion from the owned
button anchors — same proven pattern as the update pill overlay.

The previous approach failed because:
1. image-based NSToolbarItems don't expose their internal views
2. NSView.identifier matching on private toolbar views is unreliable
3. pills added to toolbar's internal superview get clipped

Amp-Thread-ID: https://ampcode.com/threads/T-019d872d-c86f-72fb-af91-81864d8eaaef
Co-authored-by: Amp <amp@ampcode.com>
Switched from Auto Layout constraints to frame-based positioning.
AppKit uses bottom-left origin (y increases upward), but Auto Layout
topAnchor with a large constant pushes downward — causing pills to
appear at the window bottom instead of above the toolbar.

Amp-Thread-ID: https://ampcode.com/threads/T-019d872d-c86f-72fb-af91-81864d8eaaef
Co-authored-by: Amp <amp@ampcode.com>
- Replace 5 separate @objc action methods with single toolbarAction(_:)
  dispatcher using KeyPath callbacks
- Consolidate toolbar item definitions, shortcut hints, and callbacks
  into a single ToolbarItemDef array
- Eliminate repetitive switch in toolbar(_:itemForItemIdentifier:) with
  data-driven lookup
- Merge toolbarDefaultItemIdentifiers and toolbarAllowedItemIdentifiers
  into shared defaultItemIds constant

Amp-Thread-ID: https://ampcode.com/threads/T-019d872d-c86f-72fb-af91-81864d8eaaef
Co-authored-by: Amp <amp@ampcode.com>
@vaayne vaayne merged commit 0567900 into main Apr 13, 2026
5 checks passed
@vaayne vaayne deleted the feat/toolbar-shortcut-hints branch April 13, 2026 14:56
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e780f618f7

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +31 to +33
ToolbarItemDef(id: ToolbarID.toggleSidebar, label: .localized("Toggle Sidebar"),
toolTip: .localized("Show or hide the sidebar (⌘B)"),
symbol: "sidebar.left", hint: "⌘B", callback: \.onToggleSidebar),
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Read toolbar hint strings from keybinding state

toolbarItemDefs now hardcodes Cmd-hold pill hints (for example "⌘B", "⌘E", "⌘D") and tooltip shortcut text, but these actions are configurable in the app’s key-binding system. If a user remaps or removes any of those bindings, the toolbar still advertises the old default shortcuts, which is misleading and points users to shortcuts that no longer work. Please derive these displayed shortcuts from the active bindings at runtime (or hide hints when unbound).

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant