summaryrefslogtreecommitdiffstats
path: root/lass/5pkgs/fzfmenu
diff options
context:
space:
mode:
authorlassulus <lassulus@lassul.us>2018-11-30 07:48:49 +0100
committerlassulus <lassulus@lassul.us>2018-11-30 07:48:49 +0100
commitcef8060bedcc33cf4b6e2781bdcbb97c2c0edba4 (patch)
treec1fc4dd0b59b39dc3cf6416c866a3a797e303f9f /lass/5pkgs/fzfmenu
parent4122e3efd5af7fc7f827aa69b5fabb577bb4d2ca (diff)
l: override dmenu with fzfmenu
Diffstat (limited to 'lass/5pkgs/fzfmenu')
-rw-r--r--lass/5pkgs/fzfmenu/default.nix33
1 files changed, 33 insertions, 0 deletions
diff --git a/lass/5pkgs/fzfmenu/default.nix b/lass/5pkgs/fzfmenu/default.nix
new file mode 100644
index 000000000..6b5899359
--- /dev/null
+++ b/lass/5pkgs/fzfmenu/default.nix
@@ -0,0 +1,33 @@
+{ pkgs, ... }:
+
+pkgs.writeDashBin "fzfmenu" ''
+ set -efu
+ PROMPT=">"
+ for i in "$@"
+ do
+ case $i in
+ -p)
+ PROMPT="$2"
+ shift
+ shift
+ break
+ ;;
+ *)
+ echo "Unknown option $1"
+ shift
+ ;;
+ esac
+ done
+ INPUT=$(${pkgs.coreutils}/bin/cat)
+ OUTPUT="$(${pkgs.coreutils}/bin/mktemp)"
+ ${pkgs.rxvt_unicode}/bin/urxvt \
+ -name fzfmenu -title fzfmenu \
+ -e ${pkgs.dash}/bin/dash -c \
+ "echo \"$INPUT\" | ${pkgs.fzf}/bin/fzf \
+ --history=/dev/null \
+ --no-sort \
+ --prompt=\"$PROMPT\" \
+ > \"$OUTPUT\"" 2>/dev/null
+ ${pkgs.coreutils}/bin/cat "$OUTPUT"
+ ${pkgs.coreutils}/bin/rm "$OUTPUT"
+''