Files
Nomarchy/modules/home/mime.nix
Bernardo Magri ac3b75b018
All checks were successful
Check / eval (push) Successful in 2m49s
feat(template): ship Chromium by default; record product decisions
- home.packages: chromium active; mime → chromium-browser.desktop
- Decisions: markdown docs stay in-repo; PPD default confirmed
- Formatter + zram still open (explained in session, not closed)

V0: flake check --no-build green.
2026-07-10 14:37:52 +01:00

62 lines
2.6 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 → mpv (the template's media player).
"video/mp4" = "mpv.desktop";
"video/webm" = "mpv.desktop";
"video/x-matroska" = "mpv.desktop";
"video/quicktime" = "mpv.desktop";
# Audio → Amberol (the template's GTK4 music player). Amberol
# registers these types itself, so this only sets the preference over
# mpv, which also claims them. Both x- and canonical names because
# files report either. Degrades to mpv/whatever if Amberol is dropped.
"audio/mpeg" = "io.bassi.Amberol.desktop";
"audio/flac" = "io.bassi.Amberol.desktop";
"audio/x-flac" = "io.bassi.Amberol.desktop";
"audio/ogg" = "io.bassi.Amberol.desktop";
"audio/x-vorbis+ogg" = "io.bassi.Amberol.desktop";
"audio/opus" = "io.bassi.Amberol.desktop";
"audio/wav" = "io.bassi.Amberol.desktop";
"audio/x-wav" = "io.bassi.Amberol.desktop";
"audio/mp4" = "io.bassi.Amberol.desktop";
"audio/x-m4a" = "io.bassi.Amberol.desktop";
"audio/aac" = "io.bassi.Amberol.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";
# Template ships chromium (chromium-browser.desktop). Entry is
# skipped by GIO if the package is deleted; install another browser
# and/or override these keys to retarget.
"text/html" = "chromium-browser.desktop";
"x-scheme-handler/http" = "chromium-browser.desktop";
"x-scheme-handler/https" = "chromium-browser.desktop";
};
};
}