aboutsummaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorArpit Chakladar <arpitchakladar@proton.me>2026-06-13 09:00:04 +0530
committerArpit Chakladar <arpitchakladar@proton.me>2026-06-13 09:00:04 +0530
commitc7deb8d3a187e626ccbf2c1a764b97d4ce1b3993 (patch)
tree4850a332d65a11b89e324946c71998f3ae3bec23 /modules
parent3ef9c2deb729ad2b9df41c09a485133087fefdea (diff)
downloadhome-manager-config-c7deb8d3a187e626ccbf2c1a764b97d4ce1b3993.tar.gz
home-manager-config-c7deb8d3a187e626ccbf2c1a764b97d4ce1b3993.zip
added the scripts to desktop items so they can be launched through application launcher
Diffstat (limited to 'modules')
-rw-r--r--modules/scripts/default.nix66
1 files changed, 60 insertions, 6 deletions
diff --git a/modules/scripts/default.nix b/modules/scripts/default.nix
index 0bb8330..9d29192 100644
--- a/modules/scripts/default.nix
+++ b/modules/scripts/default.nix
@@ -199,6 +199,27 @@ let
def.conditions or [ ]
);
+ # Generate a .desktop entry that launches the script in kitty
+ mkDesktopItem =
+ name: def:
+ let
+ sc = config.scripts.${name};
+ in
+ if sc.enable && sc.desktop.enable then
+ pkgs.makeDesktopItem {
+ name = name;
+ desktopName = sc.desktop.displayName;
+ exec = "${lib.getExe config.programs.kitty.package} -e ${lib.getExe sc.package}";
+ icon = "kitty";
+ categories = [ "Utility" ];
+ terminal = false;
+ type = "Application";
+ }
+ else
+ null;
+
+ desktopItems = lib.mapAttrsToList mkDesktopItem scriptDefs;
+
in
{
options.scripts = lib.mapAttrs (name: def: {
@@ -216,15 +237,47 @@ in
readOnly = true;
description = "The derivation for the ${name} script. Set automatically when enabled.";
};
+ desktop = {
+ enable = lib.mkOption {
+ type = lib.types.bool;
+ default = false;
+ description = "Whether to create a .desktop entry for this script.";
+ };
+ displayName = lib.mkOption {
+ type = lib.types.str;
+ default = name;
+ description = "Display name for the .desktop entry.";
+ };
+ };
}) scriptDefs;
config = {
# Wire up .package for each enabled script, with assertions for unmet conditions
- scripts = lib.mapAttrs (name: def: {
- package = lib.mkIf config.scripts.${name}.enable (
- mkScript name def.path (def.env or { }) (def.deps or [ ])
- );
- }) scriptDefs;
+ scripts =
+ lib.recursiveUpdate
+ (lib.mapAttrs (name: def: {
+ package = lib.mkIf config.scripts.${name}.enable (
+ mkScript name def.path (def.env or { }) (def.deps or [ ])
+ );
+ }) scriptDefs)
+ {
+ aria2-run.desktop = {
+ enable = true;
+ displayName = "Aria2 Download Manager";
+ };
+ i3-keybindings.desktop = {
+ enable = true;
+ displayName = "i3 Keybindings";
+ };
+ screen-recording.desktop = {
+ enable = true;
+ displayName = "Screen Recording";
+ };
+ system-monitor.desktop = {
+ enable = true;
+ displayName = "System Monitor";
+ };
+ };
assertions = lib.concatLists (
lib.mapAttrsToList (
@@ -242,6 +295,7 @@ in
pkgs.file
config.programs.bat.package
]
- ++ lib.filter (x: x != null) (lib.mapAttrsToList (_: s: s.package) config.scripts);
+ ++ lib.filter (x: x != null) (lib.mapAttrsToList (_: s: s.package) config.scripts)
+ ++ lib.filter (x: x != null) desktopItems;
};
}