refactored fzf-pass

- username and password are no longer stored and passed as variables
- no longer need to relocated to unused workspace to function.
- fixed (hopefully logic in page)
This commit is contained in:
James Patrick 2020-08-16 00:43:28 -04:00
parent 468c6f9f19
commit 3c3ca9309d

View File

@ -13,37 +13,32 @@ if [ -z "$PASSFILE" ]; then
exit 0 exit 0
fi fi
PASSDATA="$(pass "$PASSFILE")"
USRNAME="$(echo "$PASSDATA" | grep "username:" | cut -d' ' -f2-)"
PASS="$(echo "$PASSDATA" | head -n 1)"
URL="$(echo "$PASSDATA" | grep url: | cut -d' ' -f2-)"
RESP=$(cat <<EOF | fzf RESP=$(cat <<EOF | fzf
Autotype Autotype
Username Username
Password Password
URL
Page Page
EOF EOF
); );
swaymsg move container to workspace 9
case "$RESP" in case "$RESP" in
Autotype) Autotype)
ydotool type "$USRNAME" && ydotool key Tab && ydotool type "$PASS" && ydotool key Enter swaymsg exec "source ~/.profile \
&& ydotool type \"\$(pass get_user $PASSFILE)\" \
&& ydotool key TAB \
&& ydotool type \"\$(pass get_pass $PASSFILE)\""
;; ;;
Username) Username)
ydotool type "$USRNAME" swaymsg exec "source ~/.profile \
&& ydotool type \"\$(pass get_user $PASSFILE)\""
;; ;;
Password) Password)
ydotool type "$PASS" swaymsg exec "source ~/.profile \
;; && ydotool type \"\$(pass get_pass $PASSFILE)\""
URL)
ydotool type "$URL"
;; ;;
Page) Page)
"$(dirname "$0")/tty-popup" info "bash -c 'echo ${PASSDATA} | LESS=R less'" "$HOME/.config/sway/scripts/tty-popup" info \
bash -c "pass \"${PASSFILE}\" | LESS=R less"
;; ;;
*) *)
exit 1 exit 1