Skip to content

feat(command): add an action menu and Quick Look - #28

Merged
oddurs merged 1 commit into
mainfrom
feat/command-action-menu
Oct 17, 2026
Merged

oddurs merged 1 commit into
mainfrom
feat/command-action-menu

Conversation

@oddurs

@oddurs oddurs commented Oct 17, 2026

Copy link
Copy Markdown
Owner

Carries over oddurs/common-command#10, which was closed when the app moved here. The diff is the same, applied under apps/command/. It touches only the command area, not CommonKit or shared/.

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

Look at sceptically

  • The first approach failed live. The system QLPreviewPanel needs the app to be active before it can take the keyboard, and the launcher never activates. The preview opened while the previous app kept focus, the launcher closed itself, and keystrokes went to the other app. The in-panel preview above replaces it. The replacement has not been seen on screen yet.
  • QLPreviewView renders through Quick Look's service, so it can't be checked offscreen. The ⌘K and right-click menus are NSMenus, which the snapshot can't draw either, so there are no screenshots. The result list itself is unchanged.
  • The preview sits to the right of the panel, or to the left when the screen has no room on the right. It is 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. In the live test it appeared and listed Open ↩, Show in Finder ⌘↩, Quick Look ⌘Y, and Copy Path ⇧⌘C.

Checklist

  • scripts/task check command passes locally: lint, 112 tests, universal build
  • Tests for which commands each result offers
  • Under ## [Unreleased] in apps/command/CHANGELOG.md
  • Screenshots: not possible offscreen (system menu and Quick Look). The ⌘Y preview still needs a live check before the next release.

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.

Quick Look is a QLPreviewView in a non-activating panel beside the launcher rather than the system QLPreviewPanel: a live test showed the system panel couldn't get the keyboard, because the launcher never activates the app, so the launcher closed and later keystrokes went to the previous app. A panel that can't become key leaves the keyboard in the search field, so the arrows move the selection and the preview follows.
@oddurs
oddurs enabled auto-merge (squash) October 17, 2026 18:56
@oddurs
oddurs merged commit 0d083cf into main Oct 17, 2026
6 checks passed
@oddurs
oddurs deleted the feat/command-action-menu branch October 17, 2026 18:58
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