dmenu_bw: Type password instead of copying it

Auto-typing the password, instead of copying it to the clipboard, is
more secure, since any process can read the contents of the clipboard.
It is also significantly more convenient, avoiding the paste step, and
works in situations where pasting isn't possible (such as into a VM
console).
master
Dustin C. Hatch 2019-08-29 19:47:55 -05:00
parent ff8414a888
commit 1c80f5bd73
1 changed files with 2 additions and 5 deletions

7
dmenu_bw Normal file → Executable file
View File

@ -5,8 +5,5 @@ set -e
key="$(bwpass | dmenu)" key="$(bwpass | dmenu)"
[ -n "${key}" ] || exit 0 [ -n "${key}" ] || exit 0
password="$(bwpass show "${key}")" bwpass show "${key}" | tr -d '\n' | xdotool type --file -
[ -n "${password}" ] || exit 1 xdotool key Return
printf '%s' "${password}" | xclip -quiet -rmlastnl -sel clip 2> /dev/null &
sleep 12
kill $!