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";
};
config = lib.mkIf cfg.enable {
xdg.mimeApps = {
enable = true;
defaultApplications = {
# Firefox
"application/pdf" = "brave-browser.desktop";
"application/x-extension-htm" = "brave-browser.desktop";
"application/x-extension-html" = "brave-browser.desktop";
"application/x-extension-shtml" = "brave-browser.desktop";
"application/x-extension-xht" = "brave-browser.desktop";
"application/x-extension-xhtml" = "brave-browser.desktop";
"application/xhtml+xml" = "brave-browser.desktop";
"text/html" = "brave-browser.desktop";
"x-scheme-handler/about" = "brave-browser.desktop";
"x-scheme-handler/chrome" = "brave-browser.desktop";
"x-scheme-handler/http" = "brave-browser.desktop";
"x-scheme-handler/https" = "brave-browser.desktop";
xdg.mimeApps =
let
browser = "brave-browser.desktop";
mimeAppsFor =
value: list:
lib.right
builtins.listToAttrs
(map (name: { inherit name value; }))
list;
in
{
enable = true;
defaultApplications = lib.mkMerge [
(mimeAppsFor browser [
"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 = {
DEFAULT_BROWSER = "${pkgs.brave}/bin/brave";