Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- shopt -s nullglob globstar
- # settings
- typeDelay=30
- user=0
- while [ -n "$1" ]; do
- case "$1" in
- --user) user=1; shift;;
- *) break;;
- esac
- done
- function typeEnter() {
- xdotool key --delay $typeDelay Return
- }
- prefix=${PASSWORD_STORE_DIR-~/.password-store}
- password_files=( "$prefix"/**/*.gpg )
- password_files=( "${password_files[@]#"$prefix"/}" )
- password_files=( "${password_files[@]%.gpg}" )
- password_name=$(printf '%s\n' "${password_files[@]}" | dmenu "$@")
- [[ -n $password_name ]] || exit
- lines="$(pass show "$password_name" 2>/dev/null)"
- password="$(echo "$lines" | head -n1 )"
- username="$(echo "$lines" | sed -n "s/^username\:[[:blank:]]*\(.*\)$/\1/p")"
- function typeText() {
- echo -n "$@" | xdotool type --clearmodifiers --delay $typeDelay --file -
- }
- if [[ $user -eq 1 ]]; then
- typeText "$username"
- xdotool key --delay $typeDelay Tab
- fi
- typeText "$password"
Add Comment
Please, Sign In to add comment