Skip to content

feat: ⌘K command palette (fuzzy search, grouped, keyboard-first) - #1

Merged
hellno merged 2 commits into
mainfrom
hellno/commit-open-pr
Jun 5, 2026
Merged

feat: ⌘K command palette (fuzzy search, grouped, keyboard-first)#1
hellno merged 2 commits into
mainfrom
hellno/commit-open-pr

Conversation

@hellno

@hellno hellno commented Jun 5, 2026

Copy link
Copy Markdown
Owner

⌘K Command palette

A Superhuman/Linear-style command palette, built on gpui-component's List + ListDelegate
(the same searchable-list primitive Zed's own palette uses — so search, keyboard nav, scrolling
and selection come for free).

Deck command palette

What you get

  • Floating, top-anchored panel over a soft dark scrim (correct in light and dark).
  • Fuzzy search with the matched characters highlighted in the accent color.
  • Commands grouped by category (Recent → Navigation → Create → Appearance → App), with a
    Recent group that floats recently-run commands out of their category (Raycast/Spotlight style).
  • Live shortcut chips derived from the keymap — change a KeyBinding and the chip follows.
  • First row pre-selected; click or to run, esc/backdrop to close; footer hint bar; subtle fade-in.

The "shadcn" promise — adding a command is one line

It dispatches the same gpui action as the hotkey and the menu, so the three can never drift:

Command { id: "home", title: "Go Home", icon: IconName::ArrowLeft,
          category: Category::Navigation, keywords: &["back", "welcome"],
          run: Run::Action(|| Box::new(GoBack)) }

A small Run enum (Action | Accent) keeps the registry a clean literal; an ## Extending doc
block covers new Run variants, categories, and persistent recents.

How it's wired

  • TogglePalette action + secondary-k keybinding + a View-menu item (main.rs).
  • Shell owns the open/closed state, rebuilds a fresh ListState each open (query always starts
    empty), and renders the overlay as its last child (shell.rs).
  • The delegate can't reach Shell, so running a command is bridged through ListEvent: the
    delegate stashes the chosen command, Shell::on_palette_event drains it, closes the palette,
    then dispatches
    (so the action lands on Shell's focus tree).
  • Compact, dependency-free fuzzy matcher (prefix / word-boundary / consecutive bonuses; returns
    match ranges for highlighting) with 6 unit tests.

Files

  • New: src/command_palette.rs (registry, matcher, delegate, overlay, tests)
  • Wiring: src/main.rs, src/shell.rs
  • Docs: README.md (Command palette section), docs/LEARNINGS.md §16 (load-bearing details + gotchas)

Quality

cargo check + clippy clean (0 warnings) · fmt applied · 6 matcher tests pass · verified
running in light and dark. Reviewed by a multi-agent pass (correctness / DX / design) with each
finding verified against source; the confirmed polish items (light-mode scrim, selected-row icon,
long-title truncation, extension docs) are included.

🤖 Generated with Claude Code

@hellno
hellno force-pushed the hellno/commit-open-pr branch from 120f945 to e215857 Compare June 5, 2026 12:51
A Superhuman/Linear-style command palette built on gpui-component's
List + ListDelegate (the same searchable-list primitive Zed's palette uses):

- Floating top-anchored panel over a soft scrim; fuzzy search with
  accent-highlighted matched characters; commands grouped by category
  with a Recent group; live shortcut chips derived from the keymap.
- Commands run by dispatching real gpui actions, so palette == hotkey ==
  menu. A small Run enum (Action | Accent) keeps the registry a clean,
  one-line-to-add literal.
- Compact dependency-free fuzzy matcher (prefix/word-boundary/consecutive
  bonuses, returns match ranges for highlighting) with unit tests.
- Wired via TogglePalette action + secondary-k; overlay rendered by Shell;
  run bridged through ListEvent (delegate stashes pending, Shell drains).

New: src/command_palette.rs. Wiring: main.rs, shell.rs. Docs: README, LEARNINGS.
@hellno
hellno force-pushed the hellno/commit-open-pr branch from e215857 to 2e3bd65 Compare June 5, 2026 12:57
The Linux job's `cargo build --features tray` failed to link with
`unable to find library -lxdo`: tray-icon pulls libxdo-sys, which needs
the system libxdo on Linux, but it was missing from the apt list (and the
README's tray deps). Pre-existing — unrelated to the command palette.
@hellno
hellno merged commit 56f4210 into main Jun 5, 2026
2 checks passed
hellno added a commit that referenced this pull request Jun 5, 2026
Brings in the ⌘K command palette (#1) and the LEARNINGS tightening (13a300d).

Conflict resolution:
- src/main.rs (View menu): keep the new "Command Palette…" item AND the
  git-gpui-required `Menu { disabled: false, .. }` field.
- docs/LEARNINGS.md §2: keep the corrected git-default dependency story
  (the incoming side reverted to the old "longbridge fork" text).

Ported the merged-in palette to the git gpui API:
- src/command_palette.rs: window.focus(&handle, cx) (gained a cx arg).
- README "Why this exists": "pure crates.io deps" -> "fresh git-pinned GPUI".

Re-verified on the merged tree: cargo build (default + tray),
clippy -D warnings (default + tray), cargo fmt, runtime smoke (no panic).
@hellno
hellno deleted the hellno/commit-open-pr branch June 11, 2026 11:08
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