From 7fad3c1a86a8a76695d6fa3566846112e19ec008 Mon Sep 17 00:00:00 2001 From: Aly Raffauf Date: Fri, 21 Jun 2024 23:05:31 -0400 Subject: [PATCH] defaultApps: configurable default file manager --- homeManagerModules/defaultApps.nix | 2 + .../desktop/hyprland/default.nix | 2 +- homeManagerModules/desktop/sway/default.nix | 2 +- homeManagerModules/options.nix | 137 ++++++++++-------- 4 files changed, 81 insertions(+), 62 deletions(-) diff --git a/homeManagerModules/defaultApps.nix b/homeManagerModules/defaultApps.nix index 6416c526..b9b804d2 100644 --- a/homeManagerModules/defaultApps.nix +++ b/homeManagerModules/defaultApps.nix @@ -8,6 +8,7 @@ home.packages = with config.alyraffauf.defaultApps; [ audioPlayer.package editor.package + fileManager.package imageViewer.package pdfEditor.package terminal.package @@ -35,6 +36,7 @@ "audio/opus" = config.alyraffauf.defaultApps.audioPlayer.desktop; "image/jpeg" = config.alyraffauf.defaultApps.imageViewer.desktop; "image/png" = config.alyraffauf.defaultApps.imageViewer.desktop; + "inode/directory" = config.alyraffauf.defaultApps.fileManager.desktop; "text/html" = config.alyraffauf.defaultApps.webBrowser.desktop; "text/plain" = config.alyraffauf.defaultApps.editor.desktop; "text/x-python" = config.alyraffauf.defaultApps.editor.desktop; diff --git a/homeManagerModules/desktop/hyprland/default.nix b/homeManagerModules/desktop/hyprland/default.nix index a311302e..74e8b4ef 100644 --- a/homeManagerModules/desktop/hyprland/default.nix +++ b/homeManagerModules/desktop/hyprland/default.nix @@ -18,7 +18,7 @@ defaultApps = { browser = config.alyraffauf.defaultApps.webBrowser.exe; editor = config.alyraffauf.defaultApps.editor.exe; - fileManager = lib.getExe pkgs.cinnamon.nemo; + fileManager = config.alyraffauf.defaultApps.fileManager.exe; launcher = lib.getExe pkgs.fuzzel; lock = lib.getExe pkgs.swaylock; logout = lib.getExe pkgs.wlogout; diff --git a/homeManagerModules/desktop/sway/default.nix b/homeManagerModules/desktop/sway/default.nix index 9b3422e5..d920fa77 100644 --- a/homeManagerModules/desktop/sway/default.nix +++ b/homeManagerModules/desktop/sway/default.nix @@ -24,7 +24,7 @@ # Default apps browser = config.alyraffauf.defaultApps.webBrowser.exe; - fileManager = lib.getExe pkgs.cinnamon.nemo; + fileManager = config.alyraffauf.defaultApps.fileManager.exe; editor = config.alyraffauf.defaultApps.editor.exe; terminal = config.alyraffauf.defaultApps.terminal.exe; diff --git a/homeManagerModules/options.nix b/homeManagerModules/options.nix index eaa6445b..528ae57d 100644 --- a/homeManagerModules/options.nix +++ b/homeManagerModules/options.nix @@ -50,31 +50,31 @@ default = config.alyraffauf.desktop.enable; type = lib.types.bool; }; - webBrowser = { + audioPlayer = { exe = lib.mkOption { - description = "Default web browser executable name."; - default = lib.getExe config.alyraffauf.defaultApps.webBrowser.package; + description = "Default audio player executable."; + default = lib.getExe config.alyraffauf.defaultApps.audioPlayer.package; type = lib.types.str; }; desktop = lib.mkOption { - description = "Default web browser desktop file name."; - default = "firefox.desktop"; + description = "Default audio player desktop file."; + default = config.alyraffauf.defaultApps.videoPlayer.desktop; type = lib.types.str; }; package = lib.mkOption { - description = "Default web browser package."; - default = config.programs.firefox.package; + description = "Default audio player package."; + default = config.alyraffauf.defaultApps.videoPlayer.package; type = lib.types.package; }; }; editor = { exe = lib.mkOption { - description = "Default editor executable name."; + description = "Default editor executable."; default = lib.getExe config.alyraffauf.defaultApps.editor.package; type = lib.types.str; }; desktop = lib.mkOption { - description = "Default editor desktop file name."; + description = "Default editor desktop file."; default = "codium.desktop"; type = lib.types.str; }; @@ -84,60 +84,26 @@ type = lib.types.package; }; }; - terminalEditor = { + fileManager = { exe = lib.mkOption { - description = "Default terminal editor executable name."; - default = lib.getExe config.alyraffauf.defaultApps.terminalEditor.package; + description = "Default file manager executable."; + default = lib.getExe config.alyraffauf.defaultApps.fileManager.package; type = lib.types.str; }; desktop = lib.mkOption { - description = "Default terminal editor desktop file name."; - default = "nvim.desktop"; + description = "Default file manager desktop file."; + default = "nemo.desktop"; type = lib.types.str; }; package = lib.mkOption { - description = "Default terminal editor package."; - default = config.programs.neovim.package; - type = lib.types.package; - }; - }; - terminal = { - exe = lib.mkOption { - description = "Default terminal executable name."; - default = lib.getExe config.alyraffauf.defaultApps.terminal.package; - type = lib.types.str; - }; - desktop = lib.mkOption { - description = "Default terminal desktop file name."; - default = "alacritty.desktop"; - type = lib.types.str; - }; - package = lib.mkOption { - description = "Default terminal package."; - default = config.programs.alacritty.package; - type = lib.types.package; - }; - }; - pdfEditor = { - exe = lib.mkOption { - description = "Default PDF editor executable name."; - default = lib.getExe config.alyraffauf.defaultApps.pdfEditor.package; - type = lib.types.str; - }; - desktop = lib.mkOption { - description = "Default PDF Editor desktop file name."; - default = "org.gnome.Evince.desktop"; - type = lib.types.str; - }; - package = lib.mkOption { - description = "Default PDF Editor package."; - default = pkgs.evince; + description = "Default file manager package."; + default = pkgs.cinnamon.nemo; type = lib.types.package; }; }; imageViewer = { exe = lib.mkOption { - description = "Default image viewer executable name."; + description = "Default image viewer executable."; default = lib.getExe config.alyraffauf.defaultApps.imageViewer.package; type = lib.types.str; }; @@ -152,14 +118,65 @@ type = lib.types.package; }; }; + pdfEditor = { + exe = lib.mkOption { + description = "Default PDF editor executable."; + default = lib.getExe config.alyraffauf.defaultApps.pdfEditor.package; + type = lib.types.str; + }; + desktop = lib.mkOption { + description = "Default PDF Editor desktop file."; + default = "org.gnome.Evince.desktop"; + type = lib.types.str; + }; + package = lib.mkOption { + description = "Default PDF Editor package."; + default = pkgs.evince; + type = lib.types.package; + }; + }; + terminal = { + exe = lib.mkOption { + description = "Default terminal executable."; + default = lib.getExe config.alyraffauf.defaultApps.terminal.package; + type = lib.types.str; + }; + desktop = lib.mkOption { + description = "Default terminal desktop file."; + default = "alacritty.desktop"; + type = lib.types.str; + }; + package = lib.mkOption { + description = "Default terminal package."; + default = config.programs.alacritty.package; + type = lib.types.package; + }; + }; + terminalEditor = { + exe = lib.mkOption { + description = "Default terminal editor executable."; + default = lib.getExe config.alyraffauf.defaultApps.terminalEditor.package; + type = lib.types.str; + }; + desktop = lib.mkOption { + description = "Default terminal editor desktop file."; + default = "nvim.desktop"; + type = lib.types.str; + }; + package = lib.mkOption { + description = "Default terminal editor package."; + default = config.programs.neovim.package; + type = lib.types.package; + }; + }; videoPlayer = { exe = lib.mkOption { - description = "Default video player executable name."; + description = "Default video player executable."; default = lib.getExe config.alyraffauf.defaultApps.videoPlayer.package; type = lib.types.str; }; desktop = lib.mkOption { - description = "Default video player desktop file name."; + description = "Default video player desktop file."; default = "io.github.celluloid_player.Celluloid.desktop"; type = lib.types.str; }; @@ -169,20 +186,20 @@ type = lib.types.package; }; }; - audioPlayer = { + webBrowser = { exe = lib.mkOption { - description = "Default audio player executable name."; - default = lib.getExe config.alyraffauf.defaultApps.audioPlayer.package; + description = "Default web browser executable."; + default = lib.getExe config.alyraffauf.defaultApps.webBrowser.package; type = lib.types.str; }; desktop = lib.mkOption { - description = "Default audio player desktop file name."; - default = config.alyraffauf.defaultApps.videoPlayer.desktop; + description = "Default web browser desktop file."; + default = "firefox.desktop"; type = lib.types.str; }; package = lib.mkOption { - description = "Default audio player package."; - default = config.alyraffauf.defaultApps.videoPlayer.package; + description = "Default web browser package."; + default = config.programs.firefox.package; type = lib.types.package; }; };