Skip to content
This repository was archived by the owner on Oct 17, 2026. It is now read-only.

feat(panel): add an action menu and Quick Look - #10

Closed
oddurs wants to merge 2 commits into
mainfrom
feat/action-menu
Closed

oddurs wants to merge 2 commits into
mainfrom
feat/action-menu

Conversation

@oddurs

@oddurs oddurs commented Oct 17, 2026 •

Copy link
Copy Markdown
Owner

Problem

A result could be opened, or revealed with ⌘↩, and nothing else. Finder and Spotlight let you preview a file, copy its path, or quit the app you just found.

Approach

  • ItemCommand.commands(for:isRunning:) (CommandKit, tested) decides what each result offers: files and apps get Open, Show in Finder, Quick Look, Copy Path, plus Hide and Quit when the app is running; links and panes get Open and Copy; a calculation only Copy.
  • ⌘K pops up a native NSMenu under the field for the selected result; a right-click shows the same commands through SwiftUI's contextMenu (also an NSMenu). Menu items carry their symbols and the panel's own keys.
  • ⌘Y shows Quick Look beside the panel: a QLPreviewView in a non-activating panel that can never become key. The keyboard stays in the search field, so ↑ ↓ move the selection and the preview follows, ⎋ closes the preview first, and the app you were in stays active throughout.
  • ⌘⇧C copies the path (also as a file, so pasting into Finder or Mail attaches it), the link, or the result.

Look at sceptically

  • First approach failed live. The system QLPreviewPanel needs the app active to take the keyboard; the launcher never activates, so the preview opened while the previous app kept focus, the launcher closed itself, and keystrokes went to the other app. Replaced by the in-panel preview above (second commit). The replacement has not been seen on screen yet.
  • QLPreviewView renders through Quick Look's service, so it can't be checked offscreen.
  • The preview sits to the right of the panel, or to the left when the screen has no room; it's at least 380 pt tall and follows the panel as it resizes.
  • The ⌘K menu opens at a fixed point under the field, not beside the selected row. Live, it appeared and listed Open ↩, Show in Finder ⌘↩, Quick Look ⌘Y, Copy Path ⇧⌘C.

Checklist

  • scripts/task check passes locally
  • Tests for which commands each result offers
  • Verified on screen (needs a live session)

Results could only be opened or revealed. Finder and Spotlight let you preview a file, copy its path, or quit the app you found, and a launcher that can't is a step backwards. The menu is a native NSMenu on ⌘K or a right-click, and Quick Look is the system panel.
A live test showed the system Quick Look panel couldn't get the keyboard: the launcher never activates the app, so the preview opened while the previous app kept focus, the launcher closed itself, and later keystrokes went to that app. QLPreviewView in a non-activating panel that can't become key keeps the keyboard in the search field, so arrows move the selection with the preview following and no app activation changes at all.
@oddurs

oddurs commented Oct 17, 2026

Copy link
Copy Markdown
Owner Author

This repository moved into oddurs/common-tools as apps/command; open changes there.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant