mirror of
https://github.com/LukeSmithxyz/voidrice.git
synced 2026-03-20 01:37:45 +01:00
Some variables
This commit is contained in:
parent
ffdc3ceb57
commit
f173ca0ad5
@ -2,6 +2,9 @@
|
||||
|
||||
shopt -s nullglob globstar
|
||||
|
||||
clipb_clear=10
|
||||
totp_tmp="${XDG_CACHE_HOME:-$HOME/.cache}/totp-tmp.png"
|
||||
|
||||
passwordList() { \
|
||||
prefix=${PASSWORD_STORE_DIR-~/.password-store}
|
||||
password_files=( "$prefix"/**/*.gpg )
|
||||
@ -10,14 +13,14 @@ passwordList() { \
|
||||
}
|
||||
|
||||
getPasswords() { \
|
||||
choice="$(printf '%s\n' "${password_files[@]}" | grep -v "totp" | dmenu -i -p "Passwords")"
|
||||
choice="$(printf '%s\n' "${password_files[@]}" | dmenu -i -p "Passwords")"
|
||||
|
||||
if [ ! -z "$choice" ]
|
||||
then
|
||||
pass "$choice" | xclip -selection clipboard
|
||||
notify-send "📋 Password for $choice copied!"
|
||||
|
||||
sleep 10
|
||||
sleep $clipb_clear
|
||||
|
||||
printf "" | xclip -selection clipboard
|
||||
fi
|
||||
@ -31,7 +34,7 @@ getTOTP() {
|
||||
pass otp "$choice" | xclip -selection clipboard
|
||||
notify-send "📋 OTP for $choice copied!"
|
||||
|
||||
sleep 10
|
||||
sleep $clipb_clear
|
||||
|
||||
printf "" | xclip -selection clipboard
|
||||
fi
|
||||
@ -44,11 +47,11 @@ addTOTP() { \
|
||||
if [ ! -z "$name" ]
|
||||
then
|
||||
notify-send "📷 Please screenshot the QR code"
|
||||
maim -m 10 -d 0.1 -s ~/.cache/totp-tmp.png
|
||||
zbarimg -q --raw ~/.cache/totp-tmp.png | pass otp insert totp-$name &&
|
||||
maim -m 10 -d 0.1 -s "$totp_tmp"
|
||||
zbarimg -q --raw "$totp_tmp" | pass otp insert totp-$name &&
|
||||
notify-send "🔒 OTP for totp-$name added!" ||
|
||||
notify-send "❌ Failed to find QR code!"
|
||||
rm ~/.cache/totp-tmp.png
|
||||
notify-send "❌ Failed to add QR code!"
|
||||
rm "$totp_tmp"
|
||||
fi
|
||||
}
|
||||
|
||||
@ -85,7 +88,6 @@ removePassword() { \
|
||||
}
|
||||
|
||||
case "$(printf "View password\\nView TOTP\\nAdd password\\nAdd TOTP\\nRemove password" | dmenu -i -p "Passwords")" in
|
||||
|
||||
"View password") passwordList && getPasswords ;;
|
||||
"View TOTP") passwordList && getTOTP ;;
|
||||
"Add password") addPassword ;;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user