aboutsummaryrefslogtreecommitdiff
path: root/bin/menu-lpass
blob: 0d4c20072f6daa0d0122fe99a412a22dc256a0dc (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/sh
#
# Search in logins list using bemenu. Assumes a .config/logins.db.asc file exists
# with:
#     DOMAIN_1 USERNAME_1
#     DOMAIN_2 USERNAME_2
#     ...
#     DOMAIN_N USERNAME_N
# pairs, one per line.

SELECTION=`gpg --decrypt $HOME/.config/logins.db.asc 2>/dev/null | bemenu -i -s -c -l 20 -W 0.2 -p '*'`
DOMAIN=`echo $SELECTION | cut -f 1 -d ' '`
USERNAME=`echo $SELECTION | cut -f 2 -d ' '`
OPTIONS=`echo $SELECTION | cut -f 1,2 -d ' ' --complement`

if [ -z $USERNAME ] || [ -z $DOMAIN ]; then
    exit 1
fi

# -c copies to clipboard
export LESSPASS_MASTER_PASSWORD=`pass lesspass`
lpass $DOMAIN $USERNAME $OPTIONS | wl-copy -n