home: simplify mimeTypes import

This commit is contained in:
Aly Raffauf 2024-07-19 22:18:22 -04:00
parent b53a94c121
commit 259f3cbd17
2 changed files with 7 additions and 15 deletions

View file

@ -4,15 +4,7 @@
... ...
}: let }: let
cfg = config.ar.home.defaultApps; cfg = config.ar.home.defaultApps;
inherit mimeTypes = import ./mimeTypes.nix;
(import ./mimetypes.nix)
audioFiles
browserFiles
documentFiles
editorFiles
imageFiles
videoFiles
;
in { in {
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
dconf = { dconf = {
@ -50,29 +42,29 @@ in {
defaultApplications = let defaultApplications = let
mkDefaults = files: desktopFile: lib.genAttrs files (_: [desktopFile]); mkDefaults = files: desktopFile: lib.genAttrs files (_: [desktopFile]);
audioTypes = audioTypes =
mkDefaults audioFiles mkDefaults mimeTypes.audioFiles
"defaultAudioPlayer.desktop"; "defaultAudioPlayer.desktop";
browserTypes = browserTypes =
mkDefaults browserFiles mkDefaults mimeTypes.browserFiles
"defaultWebBrowser.desktop"; "defaultWebBrowser.desktop";
documentTypes = documentTypes =
mkDefaults documentFiles mkDefaults mimeTypes.documentFiles
"defaultPdfViewer.desktop"; "defaultPdfViewer.desktop";
editorTypes = editorTypes =
mkDefaults editorFiles mkDefaults mimeTypes.editorFiles
"defaultEditor.desktop"; "defaultEditor.desktop";
folderTypes = {"inode/directory" = "defaultFileManager.desktop";}; folderTypes = {"inode/directory" = "defaultFileManager.desktop";};
imageTypes = imageTypes =
mkDefaults imageFiles mkDefaults mimeTypes.imageFiles
"defaultImageViewer.desktop"; "defaultImageViewer.desktop";
videoTypes = videoTypes =
mkDefaults videoFiles mkDefaults mimeTypes.videoFiles
"defaultVideoPlayer.desktop"; "defaultVideoPlayer.desktop";
in in
audioTypes audioTypes