Skip to content

Add web search keyword shortcuts - #91

Merged
oNaiPs merged 4 commits into
mainfrom
feature/search-shortcuts
Oct 17, 2026
Merged

oNaiPs merged 4 commits into
mainfrom
feature/search-shortcuts

Conversation

@oNaiPs

@oNaiPs oNaiPs commented Oct 17, 2026

Copy link
Copy Markdown
Owner

Typing <keyword> <query> (e.g. g swift actors) puts a result like Search Google for 'swift actors' at the top of the list; Enter opens it.

  • Each shortcut has a keyword, name, template and kind:
    • url: {query} is percent-encoded (RFC 3986 unreserved chars only) and the URL opens in the default browser.
    • terminal: {query} is shell-quoted and the command runs in the terminal from Settings → General (reuses TerminalLauncher).
  • Defaults: g Google, ddg DuckDuckGo, gh GitHub, yt YouTube, w Wikipedia, c/claude Claude, gpt/chatgpt ChatGPT, p Perplexity, cc → claude '<prompt>', cx → codex '<prompt>'.
  • New Shortcuts settings pane: list, add, edit, delete, Restore Defaults. Saved as Codable JSON in UserDefaults.
  • Keywords are case-insensitive and need a space and a non-empty query.
  • Off in piped-stdin mode, since only the non-pipe provider gets wrapped.

Implementation: a new SearchShortcutProvider wraps the composite provider and implements a small QueryListProvider protocol. SearchService puts those query-dependent items in front of the fuzzy matches. Changes to shared files are small: SearchService (+3 lines), ProviderFactory (+1), AppDelegate (pane + identifier), plus the factory test.

Testing: new SearchShortcutsTests (parsing, percent-encoding, shell quoting incl. '/$(), placeholder fallback, persistence/corrupt data, case-insensitive matching, provider routing, SearchService ordering, settings model, pane). Full xcodebuild ... test passes (231 tests), and swiftlint --strict is clean.

🤖 Generated with Claude Code

Typing <keyword> <query> puts a result such as "Search Google for 'x'"
at the top of the list. Shortcuts open a URL with the query
percent-encoded, or run a command in the configured terminal with the
query shell-quoted (Claude Code, Codex). Defaults cover Google,
DuckDuckGo, GitHub, YouTube, Wikipedia, Claude, ChatGPT and Perplexity,
and are editable in a new Shortcuts settings pane. Off when a list is
piped in.
A List nested in a grouped Form is laid out as plain rows with
scrolling turned off, so shortcuts past the visible area could not be
reached. Lay the pane out as a plain stack with a bordered, scrollable
list and keep the buttons below it.
Rename the default gh shortcut to ghs and drop the claude keyword, so
gh pr list and claude still run as commands. When the keyword is a
program listed from $PATH, the shortcut goes after the regular matches.
Stored lists are left as they are.

Decode stored shortcuts one by one so an invalid entry no longer
replaces the whole list with the defaults, let the settings pane take
injected settings, and keep tests off the user's defaults.
# Conflicts:
#	README.md
#	src/SearchService.swift
@oNaiPs
oNaiPs merged commit 0cc3b90 into main Oct 17, 2026
3 checks passed
@oNaiPs
oNaiPs deleted the feature/search-shortcuts branch October 17, 2026 13:28
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