caelestia-niri/docs/tests/S028-default-apps.md
2026-12-02 14:36:20 -06:00

4.9 KiB

S028 — Default apps are honoured everywhere: test file

Written by the worker that built it, run by the test phase. Nothing here has been tested until its Result says so.

Built

  • crates/core/src/config.rs · Apps::open(kind, target) and open_with(cmd, target): the chosen command + target, xdg-open target when the setting is xdg-open or empty.
  • crates/shell/src/wl.rs · open_in(kind, target), open_path(path) (folder → explorer, file → xdg-open): utilities Play/Folder, desktop widget Open, popout recent files, notification links, portal sign-in, desktop icons.
  • crates/shell/src/capture.rs · screenshot notification "Open Folder" uses explorer.
  • crates/shell/src/deskicons.rs · open(entry, apps): a folder icon opens in explorer.
  • crates/shell/src/nexus/wallpage.rs · wallpaper folder button uses explorer.
  • crates/shell/src/nexus/mod.rs · Force toggle on stashes audio/playback/explorer, off restores them (apps_stash).

Checks

Risk: HIGH = data loss, security, crash, wrong result · MED = feature broken · LOW = looks or comfort. How: unit · integration · screen · by hand.

# Risk Do this Expect How Result
1 HIGH cargo test --release -p caelestia-core a_chosen_app_opens passes: chosen app + target, xdg-open fallback unit —
2 HIGH cargo test --release -p caelestia-shell default_apps_are_kept_through_the_force_toggle passes: choice written, shown, survives Force on/off unit —
3 HIGH Nexus → Apps, Force off, File manager = an installed file manager (e.g. Thunar); close and reopen Nexus row still shows that app; general.apps.explorer in shell.json holds its command by hand —
4 HIGH With explorer set, utilities drawer → recordings → folder button the chosen file manager opens the recordings folder, not xdg-open's default by hand —
5 MED Take a screenshot, click "Open Folder" in its notification chosen file manager opens the screenshots folder by hand —
6 MED Click "Open" in the same notification the image opens with xdg-open's image viewer by hand —
7 MED Set Media playback = mpv; play a recording from the utilities drawer mpv plays it by hand —
8 MED Set Browser = a browser; click a link in a notification body that browser opens the URL by hand —
9 MED A folder on ~/Desktop: double-click its desktop icon opens in the chosen file manager by hand —
10 MED Desktop folder widget "open_in_new" button opens the folder in the chosen file manager by hand —
11 MED Nexus → Wallpaper → open folder button wallpaper folder opens in the chosen file manager by hand —
12 MED Force on, then off the three rows show the earlier choices again, not pavucontrol/mpv/thunar by hand —
13 LOW Set every default to System Default, repeat 4, 8 xdg-open opens them as before by hand —
14 LOW rg -n '"xdg-open"' crates/shell/src only the Nexus page/toggle values; spawns all go through Apps::open integration —

Needs

A test config (XDG_CONFIG_HOME) or nested niri for 3–13; never edit the user's ~/.config/caelestia/shell.json by script. Installed file manager, mpv, a browser.

Doubts

  • The original's AppsPage.qml was not re-read (clone failed on disk quota); the kind mapping (recordings → playback, links → browser, folders → explorer) is my choice.
  • The Force stash lives only while Nexus runs: Force on, quit the shell, Force off gives pavucontrol/mpv/thunar.
  • Picking "System Default" in all three rows flips Force on by itself (the toggle is derived from the values).
  • Commands are split on spaces when picked; an Exec with quoted arguments would break.
  • A command that does not exist fails silently (spawn errors are not toasted).

Results (S035)

1 pass. 2 pass. 14 pass with one finding: remaining xdg-open spawn is launcher/mod.rs:682 (web search URL), which ignores the Browser setting. Left as is (not in the list of S028 kinds); logged for later. 3-13 not run: need Nexus clicks, installed apps and notifications.

Update (S035, nested niri)

Stand-in thunar, mpv, firefox, xdg-open on the nested niri's PATH (niri spawns apps, so its PATH counts). Config: explorer thunar, playback mpv, browser firefox. 4 pass (recordings folder button -> thunar with the recordings dir). 7 pass (play -> mpv with the file). 8 pass (expanded notification link -> firefox https://example.com/page). 9 pass (double-click desktop folder icon -> thunar with the folder). 3, 12 covered by unit test 2 only. 5, 6 (screenshot notification), 10 (desktop folder widget), 11 (wallpaper folder button), 13: not run, not tried (no screenshot taken, widget not added, wallpaper page not opened); nested niri itself works. Snapshot of Apps page: "Browser" shows xdg-open about:blank under Force, a default value, not chosen app.