3 # Copyright (c) 2014-2021 password-store contributors
5 # This program is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation, either version 2 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program. If not, see <https://www.gnu.org/licenses/>.
18 shopt -s nullglob globstar
21 if [[ $1 == "--type" ]]; then
26 if [[ -n $WAYLAND_DISPLAY ]]; then
28 xdotool
="ydotool type --file -"
29 elif [[ -n $DISPLAY ]]; then
31 xdotool
="xdotool type --clearmodifiers --file -"
33 echo "Error: No Wayland or X11 display detected" >&2
37 prefix
=${PASSWORD_STORE_DIR-~/.password-store}
38 password_files
=( "$prefix"/**/*.gpg
)
39 password_files
=( "${password_files[@]#"$prefix"/}" )
40 password_files
=( "${password_files[@]%.gpg}" )
42 password
=$
(printf '%s\n' "${password_files[@]}" |
"$dmenu" "$@")
44 [[ -n $password ]] ||
exit
46 if [[ $typeit -eq 0 ]]; then
47 pass show
-c "$password" 2>/dev
/null
49 pass show
"$password" |
{ IFS
= read -r pass
; printf %s
"$pass"; } |
$xdotool