home/defaultApps: cleanup & reorg

This commit is contained in:
Aly Raffauf 2024-06-29 22:02:23 -04:00
parent c3776d318a
commit 3d220582e9

View file

@ -1,11 +1,20 @@
{ {
pkgs,
lib,
config, config,
lib,
pkgs,
... ...
}: { }: {
config = lib.mkIf config.ar.home.defaultApps.enable { config = lib.mkIf config.ar.home.defaultApps.enable {
home.packages = with config.ar.home.defaultApps; [ dconf = {
enable = true;
settings = {
"org/cinnamon/desktop/applications/terminal".exec = "${lib.getExe config.ar.home.defaultApps.terminal}";
"org/cinnamon/desktop/default-applications/terminal".exec = "${lib.getExe config.ar.home.defaultApps.terminal}";
};
};
home = {
packages = with config.ar.home.defaultApps; [
audioPlayer audioPlayer
editor editor
fileManager fileManager
@ -17,35 +26,17 @@
webBrowser webBrowser
]; ];
dconf = { sessionVariables = {
enable = true; BROWSER = "${lib.getExe config.ar.home.defaultApps.webBrowser}";
settings = { EDITOR = "${lib.getExe config.ar.home.defaultApps.terminalEditor}";
"org/cinnamon/desktop/applications/terminal".exec = "${lib.getExe config.ar.home.defaultApps.terminal}"; TERMINAL = "${lib.getExe config.ar.home.defaultApps.terminal}";
"org/cinnamon/desktop/default-applications/terminal".exec = "${lib.getExe config.ar.home.defaultApps.terminal}";
}; };
}; };
xdg.desktopEntries = let xdg = {
mkDefaultEntry = name: package: { mimeApps = {
name = "Default ${name}";
exec = "${lib.getExe package} %U";
terminal = false;
settings = {
NoDisplay = "true";
};
};
in {
defaultAudioPlayer = mkDefaultEntry "Audio Player" config.ar.home.defaultApps.audioPlayer;
defaultEditor = mkDefaultEntry "Editor" config.ar.home.defaultApps.editor;
defaultFileManager = mkDefaultEntry "File Manager" config.ar.home.defaultApps.fileManager;
defaultImageViewer = mkDefaultEntry "Image Viewer" config.ar.home.defaultApps.imageViewer;
defaultPdfViewer = mkDefaultEntry "PDF Viewer" config.ar.home.defaultApps.pdfViewer;
defaultVideoPlayer = mkDefaultEntry "Video Player" config.ar.home.defaultApps.videoPlayer;
defaultWebBrowser = mkDefaultEntry "Web Browser" config.ar.home.defaultApps.webBrowser;
};
xdg.mimeApps = {
enable = true; enable = true;
defaultApplications = { defaultApplications = {
"application/json" = "defaultEditor.desktop"; "application/json" = "defaultEditor.desktop";
"application/pdf" = "defaultPdfViewer.desktop"; "application/pdf" = "defaultPdfViewer.desktop";
@ -87,10 +78,25 @@
"x-scheme-handler/https" = "defaultWebBrowser.desktop"; "x-scheme-handler/https" = "defaultWebBrowser.desktop";
}; };
}; };
home.sessionVariables = {
BROWSER = "${lib.getExe config.ar.home.defaultApps.webBrowser}"; desktopEntries = let
EDITOR = "${lib.getExe config.ar.home.defaultApps.terminalEditor}"; mkDefaultEntry = name: package: {
TERMINAL = "${lib.getExe config.ar.home.defaultApps.terminal}"; name = "Default ${name}";
exec = "${lib.getExe package} %U";
terminal = false;
settings = {
NoDisplay = "true";
};
};
in {
defaultAudioPlayer = mkDefaultEntry "Audio Player" config.ar.home.defaultApps.audioPlayer;
defaultEditor = mkDefaultEntry "Editor" config.ar.home.defaultApps.editor;
defaultFileManager = mkDefaultEntry "File Manager" config.ar.home.defaultApps.fileManager;
defaultImageViewer = mkDefaultEntry "Image Viewer" config.ar.home.defaultApps.imageViewer;
defaultPdfViewer = mkDefaultEntry "PDF Viewer" config.ar.home.defaultApps.pdfViewer;
defaultVideoPlayer = mkDefaultEntry "Video Player" config.ar.home.defaultApps.videoPlayer;
defaultWebBrowser = mkDefaultEntry "Web Browser" config.ar.home.defaultApps.webBrowser;
};
}; };
}; };
} }