summaryrefslogtreecommitdiff
path: root/users/kassouni/palette/rofi-palette.nix
diff options
context:
space:
mode:
Diffstat (limited to 'users/kassouni/palette/rofi-palette.nix')
-rw-r--r--users/kassouni/palette/rofi-palette.nix24
1 files changed, 24 insertions, 0 deletions
diff --git a/users/kassouni/palette/rofi-palette.nix b/users/kassouni/palette/rofi-palette.nix
new file mode 100644
index 0000000..7418ceb
--- /dev/null
+++ b/users/kassouni/palette/rofi-palette.nix
@@ -0,0 +1,24 @@
+{
+ config,
+ lib,
+ pkgs,
+ ...
+}:
+let
+ cfg = config.kassouni.palette;
+in
+{
+ # X11 front end for the palette. `-format i` makes rofi print the row index,
+ # so the label shown and the executable run stay paired by position rather
+ # than by parsing the label back out.
+ home.packages = [
+ (pkgs.writers.writeBashBin "open-palette" ''
+ set -eu
+ exes=(${lib.concatMapStringsSep " " (c: "${c.exe}") cfg.commands})
+ idx=$(${pkgs.rofi}/bin/rofi -dmenu -i -format i -p palette <<EOF
+${lib.concatMapStrings (c: "${c.icon} ${c.name}\n") cfg.commands}EOF
+ )
+ exec "''${exes[$idx]}"
+ '')
+ ];
+}