this is a lot of hoopla

This commit is contained in:
Chris Cochrun 2022-03-24 13:53:59 -05:00
parent 9a0fdfefa8
commit a8ee3f5c13
13 changed files with 151 additions and 42 deletions

View file

@ -28,14 +28,18 @@ list_passwords() {
passwords=$(rbw list)
prompt='search for passwords...'
SECRET=$(list_passwords | rofi -i -p="${prompt}" -dmenu -theme ~/.config/rofi/launchers-git/$style.rasi $@ &
c=0
while ! xprop -f _KDE_NET_WM_BLUR_BEHIND_REGION 32c -set _KDE_NET_WM_BLUR_BEHIND_REGION 0 -id $(xdotool search -class 'rofi') ; do
sleep .1
c=$((c+1))
[[ c = 50 ]] && exit; # stop script window didn't appear after 5 seconds
done
)
if [ $XDG_SESSION_TYPE = "x11" ]; then
SECRET=$(list_passwords | rofi -i -p="${prompt}" -dmenu -theme ~/.config/rofi/launchers-git/$style.rasi $@ &
c=0
while ! xprop -f _KDE_NET_WM_BLUR_BEHIND_REGION 32c -set _KDE_NET_WM_BLUR_BEHIND_REGION 0 -id $(xdotool search -class 'rofi') ; do
sleep .1
c=$((c+1))
[[ c = 50 ]] && exit; # stop script window didn't appear after 5 seconds
done
)
else
SECRET=$(list_passwords | rofi -i -p="${prompt}" -dmenu -theme ~/.config/rofi/launchers-git/$style.rasi)
fi
# Ask whether pass, user or both are required
options=("Password" \
@ -44,35 +48,40 @@ options=("Password" \
"QR-Code" \
"OTP")
option=$(printf '%s\n' "${options[@]%}" | rofi -i -dmenu -p="..." -theme ~/.config/rofi/launchers-git/$style.rasi $@ &
c=0
while ! xprop -f _KDE_NET_WM_BLUR_BEHIND_REGION 32c -set _KDE_NET_WM_BLUR_BEHIND_REGION 0 -id $(xdotool search -class 'rofi') ; do
sleep .1
c=$((c+1))
[[ c = 50 ]] && exit; # stop script window didn't appear after 5 seconds
done
)
if [ $XDG_SESSION_TYPE = "x11" ]; then
option=$(printf '%s\n' "${options[@]%}" | rofi -i -dmenu -p="..." -theme ~/.config/rofi/launchers-git/$style.rasi $@ &
c=0
while ! xprop -f _KDE_NET_WM_BLUR_BEHIND_REGION 32c -set _KDE_NET_WM_BLUR_BEHIND_REGION 0 -id $(xdotool search -class 'rofi') ; do
sleep .1
c=$((c+1))
[[ c = 50 ]] && exit; # stop script window didn't appear after 5 seconds
done
)
else
option=$(printf '%s\n' "${options[@]%}" | rofi -i -dmenu -p="..." -theme ~/.config/rofi/launchers-git/$style.rasi)
fi
# echo $option
case ${option} in
Password )
# echo "${SECRET}"
ydotool type --next-delay 500 $(rbw get "${SECRET}")
echo "${SECRET}"
xdotool type $(rbw get "${SECRET}")
;;
User )
ydotool type --next-delay 500 "$(rbw get --full "${SECRET}" | rg Username: | awk '{print $2}')"
echo "$(rbw get --full "${SECRET}" | rg Username: | awk '{print $2}')"
xdotool type "$(rbw get --full "${SECRET}" | rg Username: | awk '{print $2}')"
;;
"User and password" )
ydotool type --next-delay 500 $(rbw get --full "${SECRET}" | rg Username: | awk '{print $2}')
ydotool key TAB
ydotool type --next-delay 500 $(rbw get "${SECRET}")
xdotool type $(rbw get --full "${SECRET}" | rg Username: | awk '{print $2}')
xdotool key Tab
xdotool type $(rbw get "${SECRET}")
;;
"QR-Code" )
if [[ $SECRET =~ wifi$ ]]; then
# Produce a valid wifi QR-code
WIFISSID=$(pass get_user ${SECRET})
WIFIPASS=$(pass get_pass ${SECRET})
WIFISSID=$(pass get_user "${SECRET}")
WIFIPASS=$(pass get_pass "${SECRET}")
WIFIQR="WIFI:T:WPA;S:${WIFISSID};P:${WIFIPASS};;"
qrencode -s 8 -o - $WIFIQR | feh --title "pass: QR-WIFI" -
else
@ -80,8 +89,8 @@ case ${option} in
pass show -q1 ${SECRET}
fi
;;
"OTP" )
ydotool type --next-delay 300 $(rbw code ${SECRET})
OTP )
xdotool type $(rbw code "${SECRET}")
;;
esac