diff options
author | Joe <bousset.rudy@gmail.com> | 2022-05-12 16:30:09 +0200 |
---|---|---|
committer | Joe <bousset.rudy@gmail.com> | 2022-05-12 16:30:09 +0200 |
commit | 433d7327742bf01b4fe53fa12a62bf6832ce3cc7 (patch) | |
tree | 7fbc6abc450be9fbf8d69aed1fd439b1fb633efa /.local/bin | |
parent | Updates, new script! (diff) | |
download | dotfiles-bsd-433d7327742bf01b4fe53fa12a62bf6832ce3cc7.tar.gz dotfiles-bsd-433d7327742bf01b4fe53fa12a62bf6832ce3cc7.tar.bz2 dotfiles-bsd-433d7327742bf01b4fe53fa12a62bf6832ce3cc7.tar.xz dotfiles-bsd-433d7327742bf01b4fe53fa12a62bf6832ce3cc7.tar.zst dotfiles-bsd-433d7327742bf01b4fe53fa12a62bf6832ce3cc7.zip |
update
Diffstat (limited to '.local/bin')
-rwxr-xr-x | .local/bin/dmpass | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/.local/bin/dmpass b/.local/bin/dmpass index 8fd3568..53d148c 100755 --- a/.local/bin/dmpass +++ b/.local/bin/dmpass @@ -1,9 +1,8 @@ #!/bin/sh -typeit=0 -if [ "$1" = "--type" ]; then - typeit=1 - shift +full=0 +if [ "$1" = "--full" ]; then + full=1 fi if [ -n "$WAYLAND_DISPLAY" ]; then @@ -11,7 +10,7 @@ if [ -n "$WAYLAND_DISPLAY" ]; then xdotool="ydotool type --file -" elif [ -n "$DISPLAY" ]; then dmenu=dmenu - xdotool="xdotool type --delay 25 --clearmodifiers --file -" + xdotool="xdotool type --delay 20 --clearmodifiers --file -" else echo "Error: No Wayland or X11 display detected" >&2 exit 1 @@ -19,13 +18,18 @@ fi prefix=${PASSWORD_STORE_DIR-~/.local/share/pass} rprefix=$(printf "%s" $prefix | sed 's/\//\\\//g') -password_files=$(ls "$prefix"/**/*.gpg | sed 's/^'${rprefix}'\///g' | sed 's/\.gpg//g') +password_files=$(ls "$prefix"/*.gpg "$prefix"/*/*.gpg | sed 's/^'${rprefix}'\///g' | sed 's/\.gpg//g') password=$(printf "%s\n" "${password_files}" | "$dmenu" -i -l 15 -m 0) [ -n "$password" ] || exit -if [ $typeit -eq 0 ]; then - pass show -c "$password" >/dev/null 2>&1 -else +if [ $full -eq 1 ]; then + id=$(printf "%s" "$password" | sed 's/.*___//') + printf "%s\n" $id | { IFS= read -r pass; printf %s "$id"; } | $xdotool + xdotool key Tab pass show "$password" | { IFS= read -r pass; printf %s "$pass"; } | $xdotool + xdotool key Return + exit fi + +pass show "$password" | { IFS= read -r pass; printf %s "$pass"; } | $xdotool |