Repository navigation
Add user-defined aliases - #90
Merged
Merged
Conversation
Typing an alias exactly shows its target first; partial matches of the alias also list the target. Aliases are managed in a new Settings tab and are ignored for piped-in menus.
Aliases now store the target's file path (apps, panes) or command name ($PATH programs), falling back to the name, so same-named items don't collide. Name-only aliases saved earlier still resolve by name. The alias store is injectable and is an empty in-memory store under XCTest.
The Aliases pane uses a fixed-height bordered list so many aliases scroll instead of growing the window. Saving an alias only requires its target to be listed when the target was changed.
# Conflicts: # README.md # dmenu-mac.xcodeproj/project.pbxproj # src/AppDelegate.swift # src/CompositeListProvider.swift # src/SearchViewController.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Aliases map a short keyword to any item in the list, e.g.
ff→ Firefox orterm→ Ghostty.Behaviour
terforterm), the target is added after the regular results.cmd:<name>for $PATH programs, and the name only for anything else. Two items with the same name therefore don't collide, and the picker shows each item's folder. Aliases saved with only a name still resolve by name. If a target goes missing, the alias does nothing and Settings shows a warning next to it.PipeListProvider).<keyword> <query>is left free for search shortcuts) and must be unique. Aliases are saved to UserDefaults as Codable JSON.Implementation
Most of the code is in new files:
Aliases.swift(the model, the store andAliasSearchService, a subclass that wrapsSearchService.search),AliasSettingsModel.swiftandAliasSettingsView.swift. Changes to shared files are small: one line inSearchViewController(AliasSearchService.make(provider:)), a pane identifier and a pane entry inAppDelegate, plus aListItem.providerDataaccessor inCompositeListProviderthat reads the provider's own data without the routing tag.SearchService.swiftis unchanged.Testing
AliasSearchServiceTests(usesMockListProvider) covers exact-match ordering, case-insensitivity, no duplicates, fuzzy alias matches, missing targets, the empty query, piped mode and persistence.AliasSettingsModelTestscovers validation, saving, editing, deleting and missing targets.SettingsPanesTestshas new checks for the Aliases pane.AliasSearchService(provider:settings:),make(provider:settings:)). Under XCTest,AliasSettings.sharedis an empty in-memory store, so tests never read real aliases. To check, I wrote aliases into the realcom.onaips.dmenu-macosdefaults, ran the full suite with no failures, then removed them.xcodebuild ... test: 238 tests, 0 failures.swiftlint --strict: 0 violations.🤖 Generated with Claude Code