Skip to content

Alternate actions on the selected result with modifier keys - #89

Merged
oNaiPs merged 3 commits into
mainfrom
feature/modifier-actions
Oct 17, 2026
Merged

oNaiPs merged 3 commits into
mainfrom
feature/modifier-actions

Conversation

@oNaiPs

@oNaiPs oNaiPs commented Oct 17, 2026

Copy link
Copy Markdown
Owner

Behaviour

  • ⌘ Enter reveals the selected app, pane, or $PATH program in Finder (NSWorkspace.activateFileViewerSelecting).
  • ⌥ Enter copies the item's path to the clipboard.
  • ⌃ Enter opens a new instance of the app (OpenConfiguration.createsNewApplicationInstance). For $PATH programs it just runs them in the terminal again.
  • Alternate actions only apply to a selected item. With no match, they do nothing (typed text is not run).
  • Shift Enter still runs the typed text. Shift wins when it is combined with another modifier.
  • Piped stdin (PipeListProvider) and any provider without alternate actions fall back to plain Enter through a default ListProvider.doAction(item:action:).

Implementation

  • New src/ItemAction.swift: the ItemAction enum (mapping from modifiers), isSubmit (modified Returns reach the field editor as insertNewlineIgnoringFieldEditor: (⌥), insertLineBreak: (⌃), or noop: (⌘), and the Return keyCode check stops ⌃O from triggering it), and FileActions, whose workspace and pasteboard calls can be swapped out in tests.
  • ListProvider gains doAction(item:action:) with a default implementation. AppListProvider, CommandListProvider (which now keeps each program's full path), and CompositeListProvider implement it.
  • SearchViewController changes are limited to the Enter branch and an optional action parameter on submit.
  • README Keys table updated.

Testing

  • New ItemActionTests cover the modifier mapping, submit detection, the FileActions pasteboard, reveal, and new-instance actions, routing through the App and Composite providers, and the fallback for plain providers. There are also new tests in SearchViewControllerCommandTests and CommandListProviderTests.
  • xcodebuild ... test: 227 tests, 0 failures.
  • swiftlint --strict: 0 violations.

🤖 Generated with Claude Code

Cmd+Enter reveals the item in Finder, Option+Enter copies its path, and
Control+Enter opens a new instance of the app. Providers without file
items, such as piped stdin, keep plain Enter behaviour.
Document that wrapping providers must forward doAction(item:action:) and
test the action through the real provider stack. Cmd/Option+Enter on a
program no longer runs it when its path is unknown: the path is looked up
again, otherwise it beeps. Control+Enter on a settings pane opens it
normally instead of failing to start a new instance.
@oNaiPs
oNaiPs merged commit 05c7599 into main Oct 17, 2026
3 checks passed
@oNaiPs
oNaiPs deleted the feature/modifier-actions branch October 17, 2026 13:24
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