commit 407c71a0003e3e9e4c3acd998e5444e04811de64 parent 5aee18711b2f59631cf21c5df0766177a868f857 Author: Sven Möller <sven@svenmoeller.xyz> Date: Mon, 30 May 2022 20:09:17 +0200 No graphics mode for script Diffstat:
M | bin/.local/bin/passfill | | | 21 | ++++++++++++++++----- |
1 file changed, 16 insertions(+), 5 deletions(-)
diff --git a/bin/.local/bin/passfill b/bin/.local/bin/passfill @@ -1,8 +1,19 @@ #!/bin/sh -account="$(gopass ls --flat | dmenu | xargs -r gopass find | head -n1)" +if [ -z "$DISPLAY" ]; then + menu=fzf +else + menu=dmenu +fi + +account="$(gopass ls --flat | $menu | xargs -r gopass find | head -n1)" entry="$(gopass show "$account")" -echo "$entry" | grep "login:" | cut -d' ' -f2 | xclip -echo "$entry" | grep "url:" | cut -d' ' -f2 | xargs -r $BROWSER -gopass -c "$account" -gopass otp "$account" | xargs -r notify-send -t 60000 + +if [ -z "$DISPLAY" ]; then + gopass -o "$account" | tmux load-buffer - +else + echo "$entry" | grep "login:" | cut -d' ' -f2 | xclip + echo "$entry" | grep "url:" | cut -d' ' -f2 | xargs -r $BROWSER + gopass -c "$account" + gopass otp "$account" | xargs -r notify-send -t 60000 +fi