filetypes: new definition format

This commit is contained in:
Zynh Ludwig 2024-07-28 23:02:47 -07:00
parent 039fcb3d0e
commit b72635d019

View file

@ -6,24 +6,36 @@ in {
enable = lib.mkEnableOption "default programs"; enable = lib.mkEnableOption "default programs";
}; };
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
xdg.mimeApps = { xdg.mimeApps =
enable = true; let
defaultApplications = { browser = "brave-browser.desktop";
# Firefox
"application/pdf" = "brave-browser.desktop"; mimeAppsFor =
"application/x-extension-htm" = "brave-browser.desktop"; value: list:
"application/x-extension-html" = "brave-browser.desktop"; lib.right
"application/x-extension-shtml" = "brave-browser.desktop"; builtins.listToAttrs
"application/x-extension-xht" = "brave-browser.desktop"; (map (name: { inherit name value; }))
"application/x-extension-xhtml" = "brave-browser.desktop"; list;
"application/xhtml+xml" = "brave-browser.desktop"; in
"text/html" = "brave-browser.desktop"; {
"x-scheme-handler/about" = "brave-browser.desktop"; enable = true;
"x-scheme-handler/chrome" = "brave-browser.desktop"; defaultApplications = lib.mkMerge [
"x-scheme-handler/http" = "brave-browser.desktop"; (mimeAppsFor browser [
"x-scheme-handler/https" = "brave-browser.desktop"; "application/pdf"
"application/x-extension-htm"
"application/x-extension-html"
"application/x-extension-shtml"
"application/x-extension-xht"
"application/x-extension-xhtml"
"application/xhtml+xml"
"text/html"
"x-scheme-handler/about"
"x-scheme-handler/chrome"
"x-scheme-handler/http"
"x-scheme-handler/https"
])
];
}; };
};
home.sessionVariables = { home.sessionVariables = {
DEFAULT_BROWSER = "${pkgs.brave}/bin/brave"; DEFAULT_BROWSER = "${pkgs.brave}/bin/brave";