summaryrefslogtreecommitdiff
path: root/.local/bin/menu/pass
blob: 86fd1ee413bf29d1de7004dac08326db86fb47ad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/sh

MENU_CMD="bemenu -p 'pass'"

entry=$(find "$PASSWORD_STORE_DIR" -name '*.gpg' |\
    sed "s|$PASSWORD_STORE_DIR/||" |\
    sed "s|.gpg||" |\
    sort -n |\
    eval "$MENU_CMD") || exit 1

details=$(pass "$entry") || exit 1
user=$(echo "$details" | sed -n '2p' | sed 's|user: ||')
pass=$(echo "$details" | head -n1)

case "$(printf "autotype\npass\nuser" | eval "$MENU_CMD")" in         
    autotype) 
        wtype "$user" 
        wtype -k Tab
        wtype "$pass" ;;
    pass) 
        wtype "$pass" ;;
    user) 
        wtype "$user" ;;
esac