summaryrefslogtreecommitdiffstats
path: root/lass/5pkgs/fzfmenu
diff options
context:
space:
mode:
authorJeschli <jeschli@gmail.com>2020-04-14 20:36:21 +0200
committerJeschli <jeschli@gmail.com>2020-04-14 20:36:21 +0200
commite5342b25c149f05db86983f3785ee395c156b435 (patch)
treee45270c08010c48c27a22643bd9a3a343b880eae /lass/5pkgs/fzfmenu
parent290b6a542527a0a48c11fc2b00aee2b4d7f7df06 (diff)
parent843a537bd7fbedd8eb5fd61a1172dd8229440606 (diff)
Merge branch 'master' of https://cgit.lassul.us/stockholm
Diffstat (limited to 'lass/5pkgs/fzfmenu')
-rw-r--r--lass/5pkgs/fzfmenu/default.nix26
1 files changed, 18 insertions, 8 deletions
diff --git a/lass/5pkgs/fzfmenu/default.nix b/lass/5pkgs/fzfmenu/default.nix
index bdae8ceed..a158eeaac 100644
--- a/lass/5pkgs/fzfmenu/default.nix
+++ b/lass/5pkgs/fzfmenu/default.nix
@@ -32,14 +32,24 @@ pkgs.writeDashBin "fzfmenu" ''
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 \
- --print-query \
- --prompt=\"$PROMPT\" \
- > \"$OUTPUT\"" 2>/dev/null
+ if [ -z ''${TERM+x} ]; then #check if we can print fzf in the shell
+ ${pkgs.rxvt_unicode}/bin/urxvtc \
+ -name fzfmenu -title fzfmenu \
+ -e ${pkgs.dash}/bin/dash -c \
+ "echo \"$INPUT\" | ${pkgs.fzf}/bin/fzf \
+ --history=/dev/null \
+ --print-query \
+ --prompt=\"$PROMPT\" \
+ --reverse \
+ > \"$OUTPUT\"" 2>/dev/null
+ else
+ echo "$INPUT" | ${pkgs.fzf}/bin/fzf \
+ --history=/dev/null \
+ --print-query \
+ --prompt="$PROMPT" \
+ --reverse \
+ > "$OUTPUT"
+ fi
${pkgs.coreutils}/bin/tail -1 "$OUTPUT"
${pkgs.coreutils}/bin/rm "$OUTPUT"
''