Introduction
Introduction Statistics Contact Development Disclaimer Help
passmenu2 - sites - public wiki contents of suckless.org
git clone git://git.suckless.org/sites
Log
Files
Refs
---
passmenu2 (1244B)
---
1 #!/usr/bin/env bash
2
3 shopt -s nullglob globstar
4
5 typeit=0
6 if [[ $1 == "--type" ]]; then
7 typeit=1
8 shift
9 fi
10
11
12 STARTDIR=${PASSWORD_STORE_DIR-~/.password-store}
13 BASEDIR=$STARTDIR
14 DONE=0
15 LEVEL=0
16 PREVSELECTION=""
17 SELECTION=""
18
19 while [ "$DONE" -eq 0 ] ; do
20 password_files=( "$STARTDIR"/* )
21 password_files=( "${password_files[@]#"$STARTDIR"/}" )
22 password_files=( "${password_files[@]%.gpg}" )
23
24 if [ "$LEVEL" -ne 0 ] ; then
25 password_files=(".." "${password_files[@]}")
26 fi
27 entry=$(printf '%s\n' "${password_files[@]}" | dmenu "$@" -l 15)
28
29 echo "entry: $entry"
30 if [ -z "$entry" ] ; then
31 DONE=1
32 exit
33 fi
34
35 if [ "$entry" != ".." ] ; then
36 PREVSELECTION=$SELECTION
37 SELECTION="$SELECTION/$entry"
38
39 # check if another dir
40 if [ -d "$STARTDIR/$entry" ] ; then
41 STARTDIR="$STARTDIR/$entry"
42 LEVEL=$((LEVEL+1))
43 else
44 # not a directory so it must be a real password entry
45
46 if [[ $typeit -eq 0 ]]; then
47 pass show -c "$SELECTION" 2>/dev/null
48 else
49 xdotool - <<<"type --clearmodifiers -- $(pass show "$SELECTION" …
50 fi
51 DONE=1
52 fi
53
54 else
55 LEVEL=$((LEVEL-1))
56 SELECTION=$PREVSELECTION
57 STARTDIR="$BASEDIR/$SELECTION"
58 fi
59 done
60
You are viewing proxied material from suckless.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.