feat(desktop): viewers (zathura+imv) + xdg-mime defaults (item 8)
All checks were successful
Check / eval (push) Successful in 2m52s

The complete-workstation gap: no PDF/image viewer shipped and nothing
set mime defaults, so 'open a photo' fell to GIMP. Two new default-on
toggles: nomarchy.viewers (programs.zathura — Stylix themes it, target
added to the explicit list — plus imv) and nomarchy.mime (mkDefault
xdg.mimeApps: pdf→zathura, image→imv, av→mpv, text→code, dir→thunar;
html/http(s)→firefox as inert entries that only activate when a
browser is installed — the ship-a-browser Decision stays open, now
smaller). Associations for absent apps are skipped by GIO, so the
whole thing degrades as the user curates the suite. Deviation from
the backlog text: viewers are a module toggle, not template package
lines — zathura's theming needs its HM module (the real-config
boundary of the toggle discipline).

V1: template-home generation asserted — mimeapps.list rendered, themed
zathurarc, binaries in home-path. V3 open-a-file smoke queued.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Bernardo Magri
2026-07-04 20:06:45 +01:00
parent e05e3647e6
commit 774bdad6e4
10 changed files with 105 additions and 18 deletions

View File

@@ -223,6 +223,8 @@ two tables below are split along exactly that line.
| `nomarchy.fastfetch.enable` | `true` | fastfetch fronted by the themed Nomarchy logo | | `nomarchy.fastfetch.enable` | `true` | fastfetch fronted by the themed Nomarchy logo |
| `nomarchy.keys.enable` | `true` | gpg-agent fronting SSH + pinentry-qt | | `nomarchy.keys.enable` | `true` | gpg-agent fronting SSH + pinentry-qt |
| `nomarchy.displays.enable` | `true` | nwg-displays interactive monitor arranger (helper for `nomarchy.monitors`) | | `nomarchy.displays.enable` | `true` | nwg-displays interactive monitor arranger (helper for `nomarchy.monitors`) |
| `nomarchy.viewers.enable` | `true` | Document/image viewers: zathura (Stylix-themed PDF) + imv |
| `nomarchy.mime.enable` | `true` | Default "open with" associations (PDF/image/video/text/browser/directory); entries for apps you removed are skipped, so it degrades with the suite |
| `nomarchy.monitors` | `[]` | Declarative per-output layout → Hyprland `monitor` rules (applied on hotplug); `,preferred,auto,1` wildcard kept as fallback | | `nomarchy.monitors` | `[]` | Declarative per-output layout → Hyprland `monitor` rules (applied on hotplug); `,preferred,auto,1` wildcard kept as fallback |
| `nomarchy.themesDir` | Nomarchy's `themes/` | Where per-theme app overrides are probed | | `nomarchy.themesDir` | Nomarchy's `themes/` | Where per-theme app overrides are probed |
| `nomarchy.package` | overlay's `nomarchy-theme-sync` | The theme/state tool package, overridable if you fork it | | `nomarchy.package` | overlay's `nomarchy-theme-sync` | The theme/state tool package, overridable if you fork it |

View File

@@ -26,19 +26,6 @@ next, in what order*.
## NEXT ## NEXT
### 8. Complete-workstation viewers + default applications
New. The template ships mpv but **no PDF viewer and no image viewer**,
and nothing sets xdg-mime defaults — so "open a PDF/photo" falls to
whatever GTK guesses (GIMP for images). Two halves: (a) add a themed,
lightweight PDF viewer + image viewer to the template's active
`home.packages` (candidates: zathura or GNOME Papers; imv or loupe —
prefer what Stylix themes well); (b) a mime-defaults module setting
`xdg.mimeApps` associations (browser/PDF/image/video/text, `mkDefault`)
— real config, so unlike bare packages this *is* module territory, but
it must degrade gracefully when the user deletes a package from the
suite. **Verify:** V1 + assert the rendered mimeapps.list; V3 queue an
open-a-file smoke.
### 9. Update & rollback UX ### 9. Update & rollback UX
New; extends the update-awareness story to the other half: what changed, New; extends the update-awareness story to the other half: what changed,
and how do I get back. (a) `sys-update` prints a human diff of what the and how do I get back. (a) `sys-update` prints a human diff of what the
@@ -209,7 +196,9 @@ decide.
- **zram swap:** faster under pressure and pairs with NOW#3, but it - **zram swap:** faster under pressure and pairs with NOW#3, but it
interacts with the hibernation-swapfile story (resume device/priority interacts with the hibernation-swapfile story (resume device/priority
ordering) — adopt, adopt-with-hibernation-guard, or skip? ordering) — adopt, adopt-with-hibernation-guard, or skip?
- **Default browser:** the template comments Firefox out; item #8's mime - **Default browser:** the template comments Firefox out. The shipped
defaults need *something* to point `text/html` at — ship a browser mime defaults (item 8, done) point `text/html`/http(s) at
active in the suite, or leave browserless-by-default and let mime `firefox.desktop` as *inert* entries — they activate the moment
defaults degrade? Firefox is installed and are skipped otherwise, so the remaining call
is only: ship a browser active in the suite, or stay
browserless-by-default?

View File

@@ -86,6 +86,13 @@ QA machine), the **T14s** (webcam case).
`sudo nomarchy-snapshots`, restore a single file (`undochange`) `sudo nomarchy-snapshots`, restore a single file (`undochange`)
and walk a root-config rollback up to (or through) the and walk a root-config rollback up to (or through) the
typed-`yes` gate. typed-`yes` gate.
- [ ] **Open-a-file smoke (viewers + mime defaults, item 8)** — after
`home-update`: from yazi/Thunar, open a PDF (→ zathura, themed to
the palette), an image (→ imv, NOT GIMP), a video (→ mpv);
`xdg-open .` on a directory → Thunar. With no browser installed,
clicking a link must still fall through to *something sane* (the
firefox.desktop entries are inert); if you've uncommented a
browser, links go there.
- [ ] **Update awareness** — with `nomarchy.updates.enable`, let the timer - [ ] **Update awareness** — with `nomarchy.updates.enable`, let the timer
fire (or start the unit): indicator appears only when inputs are fire (or start the unit): indicator appears only when inputs are
behind, notification only on count growth, click opens the upgrade behind, notification only on count growth, click opens the upgrade

View File

@@ -17,6 +17,26 @@ Template:
--- ---
## 2026-07-04 — viewers + mime defaults (iteration #17, item 8)
- **Task:** BACKLOG NEXT#8 — PDF/image viewers + xdg-mime defaults.
- **Did:** modules/home/viewers.nix (`nomarchy.viewers.enable`, default
on): programs.zathura (Stylix themes it — target added to stylix.nix's
explicit list, autoEnable=false bit us first try) + imv.
modules/home/mime.nix (`nomarchy.mime.enable`): mkDefault
xdg.mimeApps for pdf→zathura, image/*→imv, av→mpv, text→code,
dir→thunar, html/http(s)→firefox as INERT entries (browser Decision
untouched — absent .desktop entries are skipped by GIO). README rows
added (option-docs enforces them now). DEVIATION from the item text:
viewers are a module toggle, not template packages — zathura's
theming needs its HM module, which is exactly the "real config"
boundary of the toggle discipline.
- **Verified:** V0; V1 — template-home generation builds; asserted
rendered mimeapps.list (all associations), themed zathurarc
(Tokyo Night rgb), imv/zathura in home-path. V3 smoke queued.
- **Pending:** V3 open-a-file smoke; browser Decision now smaller
(inert entries ship; only "active in suite?" remains).
- **Next suggestion:** NEXT#9 (update & rollback UX) — or #10 doctor.
## 2026-07-04 — docs slice (c): install story — item 6 COMPLETE (iteration #16) ## 2026-07-04 — docs slice (c): install story — item 6 COMPLETE (iteration #16)
- **Task:** BACKLOG NOW#6 slice (c), the last one — install/first-run - **Task:** BACKLOG NOW#6 slice (c), the last one — install/first-run
narrative end to end. narrative end to end.

View File

@@ -23,6 +23,8 @@
./shell.nix # zsh + starship + bat/eza/zoxide, themed ./shell.nix # zsh + starship + bat/eza/zoxide, themed
./keys.nix # gpg-agent (fronts SSH) + pinentry-qt ./keys.nix # gpg-agent (fronts SSH) + pinentry-qt
./fastfetch.nix # system info with the themed Nomarchy logo ./fastfetch.nix # system info with the themed Nomarchy logo
./viewers.nix # zathura (Stylix-themed) + imv — PDF/image viewing
./mime.nix # default applications (mimeapps.list), degrades with the suite
]; ];
# Clipboard history (wl-paste watcher); browsed via the SUPER+CTRL+V # Clipboard history (wl-paste watcher); browsed via the SUPER+CTRL+V

48
modules/home/mime.nix Normal file
View File

@@ -0,0 +1,48 @@
# Default applications (xdg mimeapps.list) — without this, "open a
# PDF/photo" falls to whatever GTK guesses first (GIMP for images).
# Every association is mkDefault AND degrades gracefully by design: an
# entry whose .desktop file isn't installed is skipped by GIO/xdg-open,
# which then falls through to whatever else claims the type — so
# deleting an app from the template suite (or never uncommenting the
# browser) leaves no broken "open" behaviour, just the old guessing.
{ config, lib, ... }:
lib.mkIf config.nomarchy.mime.enable {
xdg.mimeApps = {
enable = lib.mkDefault true;
defaultApplications = lib.mapAttrs (_: v: lib.mkDefault v) {
"application/pdf" = "org.pwmt.zathura.desktop";
"image/png" = "imv.desktop";
"image/jpeg" = "imv.desktop";
"image/gif" = "imv.desktop";
"image/webp" = "imv.desktop";
"image/avif" = "imv.desktop";
"image/bmp" = "imv.desktop";
"image/tiff" = "imv.desktop";
"image/svg+xml" = "imv.desktop";
"video/mp4" = "mpv.desktop";
"video/webm" = "mpv.desktop";
"video/x-matroska" = "mpv.desktop";
"video/quicktime" = "mpv.desktop";
"audio/mpeg" = "mpv.desktop";
"audio/flac" = "mpv.desktop";
"audio/ogg" = "mpv.desktop";
# The template's active editor; degrades if you drop vscode.
"text/plain" = "code.desktop";
# The system-side Thunar (nomarchy.system.fileManager).
"inode/directory" = "thunar.desktop";
# The template ships no browser by default (open Decision) — these
# are inert until one is installed; firefox is the template's first
# suggestion. A different browser registers its own handler and
# wins once these entries stay dead.
"text/html" = "firefox.desktop";
"x-scheme-handler/http" = "firefox.desktop";
"x-scheme-handler/https" = "firefox.desktop";
};
};
}

View File

@@ -252,6 +252,8 @@ in
btop.enable = lib.mkEnableOption "btop with the per-theme nomarchy theme" // { default = true; }; btop.enable = lib.mkEnableOption "btop with the per-theme nomarchy theme" // { default = true; };
stylix.enable = lib.mkEnableOption "Stylix theming for the long tail of apps (GTK, Qt, cursors)" // { default = true; }; stylix.enable = lib.mkEnableOption "Stylix theming for the long tail of apps (GTK, Qt, cursors)" // { default = true; };
displays.enable = lib.mkEnableOption "the nwg-displays interactive monitor arranger (a helper to find nomarchy.monitors values; the declarative config stays the source of truth)" // { default = true; }; displays.enable = lib.mkEnableOption "the nwg-displays interactive monitor arranger (a helper to find nomarchy.monitors values; the declarative config stays the source of truth)" // { default = true; };
viewers.enable = lib.mkEnableOption "the document/image viewers (zathura, Stylix-themed, + imv)" // { default = true; };
mime.enable = lib.mkEnableOption "default file associations (xdg mimeapps.list: PDF/image/video/text/browser/directory); entries for absent apps are skipped, so it degrades with the package suite" // { default = true; };
# ── Computed (read-only) ─────────────────────────────────────── # ── Computed (read-only) ───────────────────────────────────────
theme = lib.mkOption { theme = lib.mkOption {

View File

@@ -47,6 +47,8 @@ in
targets = { targets = {
gtk.enable = true; gtk.enable = true;
qt.enable = true; qt.enable = true;
# No-op unless programs.zathura is on (viewers.nix enables it).
zathura.enable = true;
}; };
cursor = { cursor = {

15
modules/home/viewers.nix Normal file
View File

@@ -0,0 +1,15 @@
# Document & image viewers — the "open a PDF / open a photo" half of a
# complete workstation. zathura goes through its HM module (not a bare
# package) because Stylix themes it via programs.zathura.options — the
# reason it's a component toggle here rather than a template package
# line. imv rides along: wayland-native, and an image viewer is a
# borderless dark surface — nothing to theme. The heavier editors
# (GIMP, Inkscape) stay template packages; mime.nix points the default
# associations at these viewers.
{ config, lib, pkgs, ... }:
lib.mkIf config.nomarchy.viewers.enable {
programs.zathura.enable = lib.mkDefault true;
home.packages = [ pkgs.imv ];
}

View File

@@ -82,7 +82,7 @@
# Office & documents # Office & documents
# onlyoffice-desktopeditors # stronger MS-Office fidelity # onlyoffice-desktopeditors # stronger MS-Office fidelity
# kdePackages.okular # PDF viewer # kdePackages.okular # heavier PDF viewer (zathura ships by default)
# xournalpp # PDF annotation # xournalpp # PDF annotation
# pdfarranger # pdfarranger
# calibre # ebook library # calibre # ebook library