blob: 4f555e4d43492a85ba48c2460933d6e67f39ba3b (
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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
#! /usr/bin/env sh
main() {
cd -- "$HOME/.password-store" || exit 1
if [ -n "$WAYLAND_DISPLAY" ]
then
file="$(pass_list | fuzzel -d)"
pass_get "$file" | wl-copy
notify "Copied $file to clipboard!"
exit 0
fi
if [ -n "$DISPLAY" ]
then
file="$(pass_list | dmenu)"
pass_get "$file" | xdotool type --file -
dmenu_exit=$?
if [ "$dmenu_exit" -ne 0 ]
then
notify "Error typing $file"
exit 2
fi
notify "Typing $file"
exit 0
fi
notify "No graphical environment detected"
}
pass_list() {
find ./* -type f \
| sed 's-^\./--' \
| sed 's-\.gpg$--'
}
pass_get() {
pass show "$1" \
| head -n 1 \
| perl -pe 'chomp'
}
notify() {
notify-send -i "dialog-password" "ipass" "$*"
}
main "$@"
|