aboutsummaryrefslogtreecommitdiff
path: root/bin/dmenu_pass.sh
blob: 2969cd16810583f62fa66afeeced15667f585a35 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# Pick and type out a pass(1) password with dmenu(1) and xdotool(1)
self=dmenu_pass
cd -- "${PASSWORD_STORE_DIR:-"$HOME"/.password-store}" || exit
# shellcheck disable=SC2016
name=$(
    find . -name \*.gpg ! -type d |
        sed -e 's_^\./__' -e 's_\.gpg$__' |
        LC_ALL=C sort -f |
        dmenu
)
[ -n "$name" ] || exit
password=$(pass show -- "$name" | head -n 1) || exit
[ -n "$password" ] || exit
printf %s "$password" | xdotool type --clearmodifiers --file - \
    || exit
notify-send --app-name="$self" -- \
    "Password typed" \
    "$name"