aboutsummaryrefslogtreecommitdiffstats
path: root/modules/desktop/rofi/default.nix
diff options
context:
space:
mode:
authorArpit Chakladar <arpitchakladar@gmail.com>2026-09-26 22:01:03 +0530
committerArpit Chakladar <arpitchakladar@gmail.com>2026-09-26 22:01:03 +0530
commitd1ec6eec44e2f7787ec670676933bbcc3d07d361 (patch)
tree7434bfc7fdd4f870dc9ea7940b767ac9400c9630 /modules/desktop/rofi/default.nix
parent0afd73753d72b7ac2de83f80f457a85a5a33a29c (diff)
downloadhome-manager-config-d1ec6eec44e2f7787ec670676933bbcc3d07d361.tar.gz
home-manager-config-d1ec6eec44e2f7787ec670676933bbcc3d07d361.zip
feat: added actions for different modules
Diffstat (limited to 'modules/desktop/rofi/default.nix')
-rw-r--r--modules/desktop/rofi/default.nix50
1 files changed, 25 insertions, 25 deletions
diff --git a/modules/desktop/rofi/default.nix b/modules/desktop/rofi/default.nix
index 0c0e6df..2eab3f2 100644
--- a/modules/desktop/rofi/default.nix
+++ b/modules/desktop/rofi/default.nix
@@ -8,30 +8,6 @@
let
cfg = config.desktop.rofi;
base16Colors = import ../../colors/base16 { inherit config lib pkgs; };
-
- actionOptionsString = lib.concatMapStringsSep "\\n" (
- action: action.name + lib.optionalString (action.icon != null) "\\0icon\\x1f${action.icon}"
- ) cfg.action.actions;
-
- actionCasesString = lib.concatStringsSep "\n" (
- map (action: " \"${action.name}\") ${action.command} ;;") cfg.action.actions
- );
-
- actionScript = pkgs.writeShellApplication {
- name = "rofi-action";
- runtimeInputs = [
- config.terminal.bash.package
- cfg.package
- ];
- text =
- builtins.replaceStrings
- [
- "@@OPTIONS@@"
- ''"@@CASES@@") : ;;''
- ]
- [ actionOptionsString actionCasesString ]
- (builtins.readFile ./rofi-action.sh);
- };
in
{
options.desktop.rofi = {
@@ -70,7 +46,6 @@ in
package = lib.mkOption {
type = lib.types.package;
readOnly = true;
- default = actionScript;
description = "The rofi-action script package.";
};
};
@@ -106,5 +81,30 @@ in
};
home.packages = lib.mkIf (cfg.action.actions != [ ]) [ cfg.action.package ];
+
+ desktop.rofi.action.package = pkgs.writeShellApplication {
+ name = "rofi-action";
+ runtimeInputs = [
+ config.terminal.bash.package
+ cfg.package
+ ];
+ text =
+ let
+ actions = cfg.action.actions;
+ optionsString = lib.concatMapStringsSep "\\n" (
+ action: action.name + lib.optionalString (action.icon != null) "\\0icon\\x1f${action.icon}"
+ ) actions;
+ casesString = lib.concatStringsSep "\n" (
+ map (action: " \"${action.name}\") ${action.command} ;;") actions
+ );
+ in
+ builtins.replaceStrings
+ [
+ "@@OPTIONS@@"
+ ''"@@CASES@@") : ;;''
+ ]
+ [ optionsString casesString ]
+ (builtins.readFile ./rofi-action.sh);
+ };
};
}