Compare commits

..

2 Commits

Author SHA1 Message Date
Gil Portenseigne b18c2233e3 amélio passmenu2 2024-05-16 13:50:00 +02:00
Gil Portenseigne b1378c422a customization pour chercher dans l'arbo des mdps directement 2024-05-14 17:48:34 +02:00
1 changed files with 6 additions and 40 deletions

View File

@ -2,29 +2,15 @@
shopt -s nullglob globstar shopt -s nullglob globstar
typeit=0
if [[ $1 == "--type" ]]; then
typeit=1
shift
fi
STARTDIR=${PASSWORD_STORE_DIR-~/.password-store} STARTDIR=${PASSWORD_STORE_DIR-~/.password-store}
BASEDIR=$STARTDIR BASEDIR=$STARTDIR
DONE=0 DONE=0
LEVEL=0 LEVEL=0
PREVSELECTION=""
SELECTION="" SELECTION=""
while [ "$DONE" -eq 0 ] ; do while [ "$DONE" -eq 0 ] ; do
password_files=( "$STARTDIR"/* ) password_files=( `find "$STARTDIR" -name "*.gpg" | sed -e 's/\.gpg//' -e 's#^.*password-store/##' ` )
password_files=( "${password_files[@]#"$STARTDIR"/}" ) entry=$(printf '%s\n' "${password_files[@]}" | dmenu -i "$@" -l 15)
password_files=( "${password_files[@]%.gpg}" )
if [ "$LEVEL" -ne 0 ] ; then
password_files=(".." "${password_files[@]}")
fi
entry=$(printf '%s\n' "${password_files[@]}" | dmenu "$@" -l 15)
echo "entry: $entry" echo "entry: $entry"
if [ -z "$entry" ] ; then if [ -z "$entry" ] ; then
@ -32,29 +18,9 @@ while [ "$DONE" -eq 0 ] ; do
exit exit
fi fi
if [ "$entry" != ".." ] ; then
PREVSELECTION=$SELECTION
SELECTION="$SELECTION/$entry"
# check if another dir SELECTION="$SELECTION/$entry"
if [ -d "$STARTDIR/$entry" ] ; then pass show "$SELECTION" | xclip -r -sel clip
STARTDIR="$STARTDIR/$entry" DONE=1
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
done done