From b208d17ed672d161388be3b7ce1f41eb94df78ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Dudr?= Date: Wed, 3 Apr 2024 09:06:56 +0200 Subject: [PATCH] gopassmenu --- bin/executable_gopassmenu | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 bin/executable_gopassmenu diff --git a/bin/executable_gopassmenu b/bin/executable_gopassmenu new file mode 100644 index 0000000..832b2c9 --- /dev/null +++ b/bin/executable_gopassmenu @@ -0,0 +1,28 @@ +#!/bin/zsh +# set -x + +if test -z $ROFI_RETV +then + rofi -show gopass -modi "gopass:$0" -kb-accept-custom "" -kb-accept-alt "" -kb-custom-2 "Control+Return" -kb-custom-1 "Shift+Return" +fi + +# echo "args $* --- retv $ROFI_RETV" >&2 + +error() { + local msg=$1 + + echo -e "\0message\x1f$(xargs <<< $msg)\n" + gopass ls -f +} + +case "$ROFI_RETV" in + # run it in backgroud and quit rofi + 0) echo -e "\0use-hot-keys\x1ftrue\n" + echo -e "\0message\x1fShift-Enter for OTP\n" + gopass ls -f ;; + 1) ( gopass show -c $1 > /dev/null ) & ;; + 10) ( + out=$(gopass otp -c $1 2>&1) + (( $? > 0 )) && error "$out" + ) & ;; +esac