{ config, lib, system, pkgs, ... }: let inherit (lib.snowfall.system) is-linux; inherit (config.marleyos) isDesktop; in { config = { home.preferXdgDirectories = true; xdg = let homeDir = config.home.homeDirectory; in lib.mkMerge [ { enable = true; cacheHome = "${homeDir}/.cache"; configHome = "${homeDir}/.config"; dataHome = "${homeDir}/.local/share"; stateHome = "${homeDir}/.local/state"; } (lib.mkIf (isDesktop && (is-linux system)) { userDirs = { enable = true; createDirectories = true; desktop = "${homeDir}/desktop"; documents = null; download = "${homeDir}/downloads"; music = null; pictures = "${homeDir}/pictures"; templates = null; videos = "${homeDir}/videos"; }; portal = { enable = true; xdgOpenUsePortal = true; extraPortals = [pkgs.xdg-desktop-portal-gtk]; config.common.default = ["gtk"]; }; mimeApps = rec { enable = true; associations.added = let browser = "${lib.getName config.marleyos.apps.browser}"; in { "application/json" = ["nvim.desktop"]; "application/pdf" = ["org.pwmt.zathura-pdf-mupdf.desktop"]; "application/xhtml+xml" = ["${browser}.desktop"]; "application/x-extension-htm" = ["${browser}.desktop"]; "application/x-extension-html" = ["${browser}.desktop"]; "application/x-extension-shtml" = ["${browser}.desktop"]; "application/x-extension-xhtml" = ["${browser}.desktop"]; "application/x-extension-xht" = ["${browser}.desktop"]; # TODO: Install a proper image viewer # "image/png" = ["feh.desktop"]; "text/html" = ["${browser}.desktop"]; "text/plain" = ["nvim.desktop"]; "x-scheme-handler/chrome" = ["${browser}.desktop"]; "x-scheme-handler/http" = ["${browser}.desktop"]; "x-scheme-handler/https" = ["${browser}.desktop"]; }; defaultApplications = associations.added; }; }) ]; }; }