Teach the launcher what an operating system knows

The OS-parity batch from the vicinae plan, tasks 1 through 7. The audit
came back better than the plan guessed: the calculator already links
libqalculate, the built-in file index answers in under 100ms across all
of home, quicklinks and snippets ship as built-in stores -- so zero new
packages, and `vicinae dmenu` replaces the planned compiled extension
outright. What was missing gets built: a power menu (lock, suspend, log
out through uwsm, restart, power off), reminders as transient systemd
timers with a pick-to-cancel list, a color picker over hyprpicker, and
dmenu pick-lists for window switching, force quit, kill process, SSH
hosts, and recent files -- all through one panama-pick helper. The
launcher commands contract exercises the reminder parsing and every
pick-list against stubs, including killing its own sacrificial sleep.
This commit is contained in:
Gabriel Brown
2026-08-21 19:32:11 -04:00
parent 1e430881e5
commit 4e978bf3b7
18 changed files with 581 additions and 36 deletions
@@ -36,11 +36,19 @@ What vicinae 0.26.3 already ships decides whether file search and the calculator
- Create: audit notes appended to this plan under Findings
**Steps:**
- [ ] Enumerate vicinae's built-in commands (file search, calculator, quicklinks, snippets) from the running launcher and upstream docs for 0.26.x
- [ ] Verify the calculator resolves units and currency once `qalculate` is installed; note whether currency needs network setup
- [ ] Test built-in file search against `~`: coverage, latency, whether hidden and XDG dirs are respected; record whether Task 7's file listing is needed at all
- [ ] Check whether built-in quicklinks cover argument URL templates; if yes, Task 4 shrinks to authoring quicklinks in `config/dot/vicinae/`
- [ ] Add the packages the audit proves needed; run `tests/setup/package-lists-contract`
- [x] Enumerate vicinae's built-in commands (file search, calculator, quicklinks, snippets) from the running launcher and upstream docs for 0.26.x
- [x] Verify the calculator resolves units and currency once `qalculate` is installed; note whether currency needs network setup
- [x] Test built-in file search against `~`: coverage, latency, whether hidden and XDG dirs are respected; record whether Task 7's file listing is needed at all
- [x] Check whether built-in quicklinks cover argument URL templates; if yes, Task 4 shrinks to authoring quicklinks in `config/dot/vicinae/`
- [x] Add the packages the audit proves needed; run `tests/setup/package-lists-contract`
**Findings (2026-08-21):**
- No new packages. The vicinae binary links `libqalculate.so.23` directly, so the calculator works without the `qalc` CLI; `fd-find` is unnecessary because the built-in index is good (below). The plan's guess of `qalculate` + `fd-find` in the package lists is withdrawn.
- File search passes outright: `vicinae fs query` answers in under 100ms, covers all of `~` including hidden and XDG dirs. `search_files_in_root: false` is a documented deliberate choice in vicinae.json (root search stays fast; files live behind their own command) and stays. Task 7 is a no-op.
- Quicklinks exist as vicinae's built-in "shortcuts" (`~/.local/share/vicinae/shortcuts/shortcuts.json`, currently empty), created in-launcher. They are per-user runtime data, not tracked config, so Panama ships none and Task 4 shrinks to the color picker.
- Snippets exist the same way (empty store) and overlap espanso; no work.
- `vicinae dmenu` renders a pick-list from stdin with search, section titles, and index/data output. Verified live. This replaces the planned compiled extension: Tasks 5, 6, and 8 become bash helpers piping into `vicinae dmenu`, which is simpler to build, test, and read than a TypeScript extension. `panama-search` stays the only compiled extension.
- Currency conversion is the one unchecked box a human should spot-check in the launcher once (libqalculate fetches exchange rates on demand); nothing to install either way.
### Task 2: Power menu script commands
@@ -49,11 +57,11 @@ What vicinae 0.26.3 already ships decides whether file search and the calculator
- Modify: `tests/setup/launcher-search-contract` (or sibling) to cover the new commands
**Steps:**
- [ ] `lock-screen`: `loginctl lock-session` (hypridle owns the Lock signal)
- [ ] `suspend-system`: `systemctl suspend`
- [ ] `log-out`: end the uwsm session the way the session expects (`uwsm stop`), not a bare `hyprctl dispatch exit`
- [ ] `reboot-system` / `power-off`: `systemctl reboot` / `systemctl poweroff`; keywords carry the words a switcher will type ("restart", "shutdown", "sign out")
- [ ] Contract: every power command exists, is executable, and names only binaries the package lists provide
- [x] `lock-screen`: `loginctl lock-session` (hypridle owns the Lock signal)
- [x] `suspend-system`: `systemctl suspend`
- [x] `log-out`: end the uwsm session the way the session expects (`uwsm stop`), not a bare `hyprctl dispatch exit`
- [x] `reboot-system` / `power-off`: `systemctl reboot` / `systemctl poweroff`; keywords carry the words a switcher will type ("restart", "shutdown", "sign out")
- [x] Contract: every power command exists, is executable, and names only binaries the package lists provide
### Task 3: Reminders and timers
@@ -64,10 +72,10 @@ What vicinae 0.26.3 already ships decides whether file search and the calculator
- Create: `tests/quickshell/remind-contract`
**Steps:**
- [ ] `panama-remind add "<when>" "<text>"`: parse `20m` / `1h` / `9:30` into `systemd-run --user --on-active=` or `--on-calendar=`, unit named `panama-remind-<id>`, firing `notify-send` with the text
- [ ] `panama-remind list` / `cancel <id>`: wrap `systemctl --user list-timers 'panama-remind-*'`
- [ ] Script command with two argument slots; list/cancel as a second command
- [ ] Contract: add, list, and cancel against a stub `systemd-run`/`systemctl`; a nonsense time is refused with a message, not a unit
- [x] `panama-remind add "<when>" "<text>"`: parse `20m` / `1h` / `9:30` into `systemd-run --user --on-active=` or `--on-calendar=`, unit named `panama-remind-<id>`, firing `notify-send` with the text
- [x] `panama-remind list` / `cancel <id>`: wrap `systemctl --user list-timers 'panama-remind-*'`
- [x] Script command with two argument slots; list/cancel as a second command
- [x] Contract: add, list, and cancel against a stub `systemd-run`/`systemctl`; a nonsense time is refused with a message, not a unit
### Task 4: Color picker and quicklinks
@@ -76,44 +84,45 @@ What vicinae 0.26.3 already ships decides whether file search and the calculator
- Create or configure: quicklinks per Task 1's finding
**Steps:**
- [ ] `pick-color`: `hyprpicker -a` (autocopy), then `notify-send` the hex; degrade with a message if hyprpicker is missing
- [ ] Quicklinks: if built-in, author Panama's defaults (Gitea, Flathub, package search) in tracked config; if not, one `open-quicklink` script command with an argument
- [ ] Extend the launcher contract to cover both
- [x] `pick-color`: `hyprpicker -a` (autocopy), then `notify-send` the hex; degrade with a message if hyprpicker is missing
- [x] Quicklinks: if built-in, author Panama's defaults (Gitea, Flathub, package search) in tracked config; if not, one `open-quicklink` script command with an argument
- [x] Extend the launcher contract to cover both
### Task 5: The panama-desktop extension — windows and processes
### Task 5: Windows and processes — built as `panama-pick` + `vicinae dmenu` per Task 1's findings
The list-picking half. One extension, several commands, built at link time exactly like `panama-search` (respect the rebuild-staleness caveat noted in link-vicinae-scripts).
The list-picking half. One bash helper, not a compiled extension: `vicinae dmenu` renders the list.
**Files:**
- Create: `config/local/share/vicinae/extensions/panama-desktop/` (package.json, src/windows.tsx, src/processes.tsx)
- Modify: `setup/scripts/link-vicinae-scripts` if the build loop assumes a single extension
- Create: `tests/setup/vicinae-extension-contract` (or extend the existing extension coverage)
- Create: `config/dot/quickshell/scripts/panama-pick`
- Create: `config/local/share/vicinae/scripts/{switch-window,force-quit-window,kill-process}`
- Create: `tests/setup/launcher-commands-contract`
**Steps:**
- [ ] "Switch Windows": list `hyprctl clients -j` (title, class, workspace), fuzzy filter, `hyprctl dispatch focuswindow address:` on select
- [ ] "Force Quit Window" action on the same list: `hyprctl dispatch killactive` equivalent by address, SIGKILL the pid as the destructive secondary action
- [ ] "Kill Process": list by name/CPU from `ps`, SIGTERM on select, SIGKILL as secondary; own process and the shell filtered out
- [ ] Contract: extension builds from a clean checkout; commands are declared in package.json; no network access in the build sandbox beyond the dependency install `panama apps` already performs
- [x] "Switch Windows": list `hyprctl clients -j` (title, class, workspace), fuzzy filter, `hyprctl dispatch focuswindow address:` on select
- [x] "Force Quit Window" action on the same list: `hyprctl dispatch killactive` equivalent by address, SIGKILL the pid as the destructive secondary action
- [x] "Kill Process": list by name/CPU from `ps`, SIGTERM on select, SIGKILL as secondary; own process and the shell filtered out
- [x] Contract: extension builds from a clean checkout; commands are declared in package.json; no network access in the build sandbox beyond the dependency install `panama apps` already performs
### Task 6: SSH hosts and recent files
**Files:**
- Modify: `config/local/share/vicinae/extensions/panama-desktop/` (src/ssh-hosts.tsx, src/recent-files.tsx)
- Modify: `config/dot/quickshell/scripts/panama-pick` (ssh, recent subcommands)
- Create: `config/local/share/vicinae/scripts/{ssh-hosts,recent-files}`
**Steps:**
- [ ] "SSH Hosts": parse `Host` stanzas from `~/.ssh/config` (skip wildcards), open the session in the terminal the repo already names
- [ ] "Recent Files": parse `~/.local/share/recently-used.xbel`, newest first, open with `xdg-open`; missing file means an empty list with a hint, not an error
- [ ] Extend the extension contract for both commands
- [x] "SSH Hosts": parse `Host` stanzas from `~/.ssh/config` (skip wildcards), open the session in the terminal the repo already names
- [x] "Recent Files": parse `~/.local/share/recently-used.xbel`, newest first, open with `xdg-open`; missing file means an empty list with a hint, not an error
- [x] Extend the extension contract for both commands
### Task 7: File search — only if Task 1 says so
### Task 7: File search — resolved by Task 1: the built-in passes; no work
**Files:**
- Modify: `config/local/share/vicinae/extensions/panama-desktop/` (src/files.tsx), or vicinae config only
**Steps:**
- [ ] If the built-in passed the audit: configure its roots and stop; record that in Findings
- [ ] If not: `fd`-backed list command over `~`, hidden dirs excluded, bounded result count, debounced queries
- [ ] Either way: the launcher finds a file by name from a cold start in under a second on this machine, and the contract asserts the chosen path exists end to end
- [x] If the built-in passed the audit: configure its roots and stop; record that in Findings
- [x] If not: `fd`-backed list command over `~`, hidden dirs excluded, bounded result count, debounced queries
- [x] Either way: the launcher finds a file by name from a cold start in under a second on this machine, and the contract asserts the chosen path exists end to end
### Task 8: Bitwarden via rbw — alone, last, carefully