1
0
mirror of https://github.com/kmein/niveum synced 2026-03-16 10:11:08 +01:00

feat(i3): use fzfmenu

This commit is contained in:
Kierán Meinhardt
2020-04-10 14:53:16 +02:00
parent b284b2aabb
commit 8a7fd14968
3 changed files with 47 additions and 1 deletions

View File

@@ -107,7 +107,7 @@ in with config.niveum; {
"${modifier}+a" = "exec ${pkgs.rofi}/bin/rofi -display-window -show window"; "${modifier}+a" = "exec ${pkgs.rofi}/bin/rofi -display-window -show window";
"${modifier}+b" = "workspace prev"; "${modifier}+b" = "workspace prev";
"${modifier}+c" = "split h"; "${modifier}+c" = "split h";
"${modifier}+d" = "exec ${pkgs.rofi}/bin/rofi -display-combi $ -show combi -show-icons -combi-modi drun#run -modi drun#run"; "${modifier}+d" = "exec ${pkgs.dmenu}/bin/dmenu_path | ${pkgs.scripts.fzfmenu}/bin/fzfmenu | \${SHELL:-/bin/sh} &";
"${modifier}+e" = "layout toggle split"; "${modifier}+e" = "layout toggle split";
"${modifier}+f" = "fullscreen toggle"; "${modifier}+f" = "fullscreen toggle";
"${modifier}+h" = "focus left"; "${modifier}+h" = "focus left";

View File

@@ -97,6 +97,12 @@ in
name = "notetags"; name = "notetags";
}; };
fzfmenu = makeScript {
src = ./fzfmenu.sh;
name = "fzfmenu";
propagatedBuildInputs = [ pkgs.alacritty pkgs.fzf ];
};
bvg = pkgs.callPackage ./bvg.nix {}; bvg = pkgs.callPackage ./bvg.nix {};
nav = pkgs.callPackage ./nav.nix {}; nav = pkgs.callPackage ./nav.nix {};
} }

40
packages/scripts/fzfmenu.sh Executable file
View File

@@ -0,0 +1,40 @@
#!/bin/sh
set -efu
PROMPT="fzfmenu: "
for i in "$@"; do
case $i in
-p)
PROMPT="$2"
shift
shift
break ;;
-l)
# no reason to filter number of lines
LINES="$2"
shift
shift
break ;;
-i)
# we do this anyway
shift
break ;;
*)
echo "Unknown option $1" >&2
shift ;;
esac
done
INPUT=$(cat)
OUTPUT="$(mktemp)"
alacritty \
--title fzfmenu \
--dimensions 85 15 \
-e sh -c \
"echo \"$INPUT\" | fzf \
--history=/dev/null \
--no-sort \
--prompt=\"$PROMPT\" \
> \"$OUTPUT\"" 2>/dev/null
cat "$OUTPUT"
rm "$OUTPUT"