home/defaultApps: add forceMimeAssociations option

This commit is contained in:
Aly Raffauf 2024-12-19 11:11:07 -05:00
parent 628b6d3a98
commit 5f4fdf1c09
2 changed files with 13 additions and 10 deletions

View file

@ -42,7 +42,7 @@ in {
WebBrowser=${builtins.baseNameOf (lib.getExe cfg.webBrowser)} WebBrowser=${builtins.baseNameOf (lib.getExe cfg.webBrowser)}
''; '';
mimeApps = { mimeApps = lib.mkIf cfg.forceMimeAssociations {
enable = true; enable = true;
defaultApplications = let defaultApplications = let
@ -93,15 +93,16 @@ in {
NoDisplay = "true"; NoDisplay = "true";
}; };
}; };
in { in
defaultAudioPlayer = mkDefaultEntry "Audio Player" cfg.audioPlayer; lib.mkIf cfg.forceMimeAssociations {
defaultEditor = mkDefaultEntry "Editor" cfg.editor; defaultAudioPlayer = mkDefaultEntry "Audio Player" cfg.audioPlayer;
defaultFileManager = mkDefaultEntry "File Manager" cfg.fileManager; defaultEditor = mkDefaultEntry "Editor" cfg.editor;
defaultImageViewer = mkDefaultEntry "Image Viewer" cfg.imageViewer; defaultFileManager = mkDefaultEntry "File Manager" cfg.fileManager;
defaultPdfViewer = mkDefaultEntry "PDF Viewer" cfg.pdfViewer; defaultImageViewer = mkDefaultEntry "Image Viewer" cfg.imageViewer;
defaultVideoPlayer = mkDefaultEntry "Video Player" cfg.videoPlayer; defaultPdfViewer = mkDefaultEntry "PDF Viewer" cfg.pdfViewer;
defaultWebBrowser = mkDefaultEntry "Web Browser" cfg.webBrowser; defaultVideoPlayer = mkDefaultEntry "Video Player" cfg.videoPlayer;
}; defaultWebBrowser = mkDefaultEntry "Web Browser" cfg.webBrowser;
};
}; };
}; };
} }

View file

@ -77,6 +77,8 @@ in {
defaultApps = { defaultApps = {
enable = lib.mkEnableOption "Declaratively set default apps and file associations."; enable = lib.mkEnableOption "Declaratively set default apps and file associations.";
forceMimeAssociations = lib.mkEnableOption "Force mime associations for defaultApps.";
audioPlayer = lib.mkPackageOption pkgs "audio player" {default = ["celluloid"];}; audioPlayer = lib.mkPackageOption pkgs "audio player" {default = ["celluloid"];};
editor = lib.mkPackageOption pkgs "text editor" {default = ["vscodium"];}; editor = lib.mkPackageOption pkgs "text editor" {default = ["vscodium"];};
fileManager = lib.mkPackageOption pkgs "file manager" {default = ["nemo"];}; fileManager = lib.mkPackageOption pkgs "file manager" {default = ["nemo"];};