diff options
Diffstat (limited to 'modules/desktop/rofi')
| -rw-r--r-- | modules/desktop/rofi/default.nix | 50 | ||||
| -rw-r--r-- | modules/desktop/rofi/rofi-action.sh | 1 |
2 files changed, 25 insertions, 26 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); + }; }; } diff --git a/modules/desktop/rofi/rofi-action.sh b/modules/desktop/rofi/rofi-action.sh index 1e09b75..844e0c9 100644 --- a/modules/desktop/rofi/rofi-action.sh +++ b/modules/desktop/rofi/rofi-action.sh @@ -8,6 +8,5 @@ options="@@OPTIONS@@" chosen=$(echo -e "$options" | rofi -dmenu -i -p "Action:") case "$chosen" in -# replacing "@@CASES@@") : ;; instead of @@CASES@@ for linter/formatter "@@CASES@@") : ;; esac |
