Manage default applications with home-manager

This commit is contained in:
Pim Kunis 2024-06-15 14:18:36 +02:00
parent b6b5d5901c
commit 62265a466c

View file

@ -7,7 +7,81 @@
]; ];
xsession.enable = true; xsession.enable = true;
xdg.userDirs.enable = true;
xdg = {
userDirs.enable = true;
mimeApps = {
enable = true;
defaultApplications =
let
applications = {
telegram = {
mimeApp = "org.telegram.desktop.desktop";
mimeTypes = [ "x-scheme-handler/tg" ];
};
librewolf = {
mimeApp = "librewolf.desktop";
mimeTypes = [
"x-scheme-handler/http"
"text/html"
"application/xhtml+xml"
"x-scheme-handler/https"
"application/pdf"
];
};
gnomeTextEditor = {
mimeApp = "org.gnome.TextEditor.desktop";
mimeTypes = [ "text/plain" ];
};
thunderbird = {
mimeApp = "thunderbird.desktop";
mimeTypes = [ "x-scheme-handler/mailto" ];
};
loupe = {
mimeApp = "org.gnome.Loupe.desktop";
mimeTypes = [
"image/jpeg"
"image/png"
"image/gif"
"image/webp"
"image/tiff"
"image/x-tga"
"image/vnd-ms.dds"
"image/x-dds"
"image/bmp"
"image/vnd.microsoft.icon"
"image/vnd.radiance"
"image/x-exr"
"image/x-portable-bitmap"
"image/x-portable-graymap"
"image/x-portable-pixmap"
"image/x-portable-anymap"
"image/x-qoi"
"image/svg+xml"
"image/svg+xml-compressed"
"image/avif"
"image/heic"
"image/jxl"
];
};
};
mimeTypesForApp = { mimeApp, mimeTypes }: map
(
mimeType: { "${mimeType}" = mimeApp; }
)
mimeTypes;
in
lib.zipAttrs (lib.flatten (map mimeTypesForApp (builtins.attrValues applications)));
};
};
home = { home = {
username = "pim"; username = "pim";