From b18c2233e3178dd25aa3d9e616833566fdfdb39a Mon Sep 17 00:00:00 2001 From: Gil Portenseigne Date: Thu, 16 May 2024 13:50:00 +0200 Subject: [PATCH] =?UTF-8?q?am=C3=A9lio=20passmenu2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .local/bin/passmenu2 | 44 ++++++-------------------------------------- 1 file changed, 6 insertions(+), 38 deletions(-) diff --git a/.local/bin/passmenu2 b/.local/bin/passmenu2 index 8211515..ea1a76e 100755 --- a/.local/bin/passmenu2 +++ b/.local/bin/passmenu2 @@ -2,27 +2,15 @@ shopt -s nullglob globstar -typeit=0 -if [[ $1 == "--type" ]]; then - typeit=1 - shift -fi - - STARTDIR=${PASSWORD_STORE_DIR-~/.password-store} BASEDIR=$STARTDIR DONE=0 LEVEL=0 -PREVSELECTION="" SELECTION="" while [ "$DONE" -eq 0 ] ; do - password_files=( `find "$STARTDIR" -iname "*.gpg" | sed -e 's/\.gpg//' -e 's#^.*password-store/##' ` ) - - if [ "$LEVEL" -ne 0 ] ; then - password_files=(".." "${password_files[@]}") - entry=$(printf '%s\n' "${password_files[@]}" | dmenu "$@" -l 15) - fi + password_files=( `find "$STARTDIR" -name "*.gpg" | sed -e 's/\.gpg//' -e 's#^.*password-store/##' ` ) + entry=$(printf '%s\n' "${password_files[@]}" | dmenu -i "$@" -l 15) echo "entry: $entry" if [ -z "$entry" ] ; then @@ -30,29 +18,9 @@ while [ "$DONE" -eq 0 ] ; do exit fi - if [ "$entry" != ".." ] ; then - PREVSELECTION=$SELECTION - SELECTION="$SELECTION/$entry" - - # check if another dir - if [ -d "$STARTDIR/$entry" ] ; then - STARTDIR="$STARTDIR/$entry" - LEVEL=$((LEVEL+1)) - else - # not a directory so it must be a real password entry - - if [[ $typeit -eq 0 ]]; then - pass show -c "$SELECTION" 2>/dev/null - else - xdotool - <<<"type --clearmodifiers -- $(pass show "$SELECTION" | head -n 1)" - fi - DONE=1 - fi - - else - LEVEL=$((LEVEL-1)) - SELECTION=$PREVSELECTION - STARTDIR="$BASEDIR/$SELECTION" - fi + + SELECTION="$SELECTION/$entry" + pass show "$SELECTION" | xclip -r -sel clip + DONE=1 done