Files
Nomarchy/modules/home/mime.nix
Bernardo Magri 774bdad6e4
All checks were successful
Check / eval (push) Successful in 2m52s
feat(desktop): viewers (zathura+imv) + xdg-mime defaults (item 8)
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>
2026-07-04 20:06:45 +01:00

49 lines
1.9 KiB
Nix

# 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";
};
};
}