mirror of
https://github.com/LukeSmithxyz/voidrice.git
synced 2026-03-20 01:37:45 +01:00
Big cleanup
This commit is contained in:
parent
f173ca0ad5
commit
e25032bc26
@ -2,74 +2,65 @@
|
|||||||
|
|
||||||
shopt -s nullglob globstar
|
shopt -s nullglob globstar
|
||||||
|
|
||||||
clipb_clear=10
|
|
||||||
totp_tmp="${XDG_CACHE_HOME:-$HOME/.cache}/totp-tmp.png"
|
totp_tmp="${XDG_CACHE_HOME:-$HOME/.cache}/totp-tmp.png"
|
||||||
|
|
||||||
passwordList() { \
|
passwordList() { \
|
||||||
prefix=${PASSWORD_STORE_DIR-~/.password-store}
|
prefix=${PASSWORD_STORE_DIR-~/.password-store}
|
||||||
password_files=( "$prefix"/**/*.gpg )
|
|
||||||
password_files=( "${password_files[@]#"$prefix"/}" )
|
password_files=("$prefix"/**/*.gpg)
|
||||||
password_files=( "${password_files[@]%.gpg}" )
|
password_files=("${password_files[@]#"$prefix"/}")
|
||||||
|
password_files=("${password_files[@]%.gpg}")
|
||||||
|
password_files=$(printf '%s\n' "${password_files[@]}")
|
||||||
}
|
}
|
||||||
|
|
||||||
getPasswords() { \
|
getPasswords() { \
|
||||||
choice="$(printf '%s\n' "${password_files[@]}" | dmenu -i -p "Passwords")"
|
choice="$(echo "$password_files" | dmenu -i -p "Passwords")"
|
||||||
|
|
||||||
if [ ! -z "$choice" ]
|
[ -z "$choice" ] && exit
|
||||||
then
|
|
||||||
pass "$choice" | xclip -selection clipboard
|
pass -c "$choice"
|
||||||
notify-send "📋 Password for $choice copied!"
|
notify-send "📋 Password for $choice copied!"
|
||||||
|
|
||||||
sleep $clipb_clear
|
|
||||||
|
|
||||||
printf "" | xclip -selection clipboard
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getTOTP() {
|
getTOTP() {
|
||||||
choice="$(printf '%s\n' "${password_files[@]}" | grep "totp" | dmenu -i -p "OTP")"
|
choice="$(echo "$password_files" | grep "totp" | dmenu -i -p "OTP")"
|
||||||
|
|
||||||
if [ ! -z "$choice" ]
|
[ -z "$choice" ] && exit
|
||||||
then
|
|
||||||
pass otp "$choice" | xclip -selection clipboard
|
pass otp -c "$choice"
|
||||||
notify-send "📋 OTP for $choice copied!"
|
notify-send "📋 OTP for $choice copied!"
|
||||||
|
|
||||||
sleep $clipb_clear
|
|
||||||
|
|
||||||
printf "" | xclip -selection clipboard
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
addTOTP() { \
|
addTOTP() { \
|
||||||
ifinstalled zbarimg || exit
|
ifinstalled zbarimg || exit
|
||||||
|
|
||||||
name=$(printf "" | dmenu -i -p "What is the account name?")
|
name=$(printf "" | dmenu -i -p "What is the account name?")
|
||||||
if [ ! -z "$name" ]
|
|
||||||
then
|
[ -z "$name" ] && exit
|
||||||
|
|
||||||
notify-send "📷 Please screenshot the QR code"
|
notify-send "📷 Please screenshot the QR code"
|
||||||
maim -m 10 -d 0.1 -s "$totp_tmp"
|
maim -m 10 -d 0.1 -s "$totp_tmp"
|
||||||
zbarimg -q --raw "$totp_tmp" | pass otp insert totp-$name &&
|
zbarimg -q --raw "$totp_tmp" | pass otp insert totp-$name &&
|
||||||
notify-send "🔒 OTP for totp-$name added!" ||
|
notify-send "🔒 OTP for totp-$name added!" ||
|
||||||
notify-send "❌ Failed to add QR code!"
|
notify-send "❌ Failed to add QR code!"
|
||||||
rm "$totp_tmp"
|
rm "$totp_tmp"
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
addPassword() { \
|
addPassword() { \
|
||||||
name=$(printf "" | dmenu -i -p "What is the account name?")
|
name=$(printf "" | dmenu -i -p "What is the account name?")
|
||||||
if [ ! -z "$name" ]
|
|
||||||
then
|
[ -z "$name" ] && exit
|
||||||
|
|
||||||
case "$(printf "Random password\\nManual password" | dmenu -i -p "Passwords")" in
|
case "$(printf "Random password\\nManual password" | dmenu -i -p "Passwords")" in
|
||||||
"Random password") addPass=$(tr -dc A-Za-z0-9 < /dev/urandom | head -c $(printf "12\\n32\\n128" | dmenu -i -p "How many characters?") ; echo '') ;;
|
"Random password") addPass=$(tr -dc '\40-\176' < /dev/urandom | tr -d ' ' | head -c $(printf "12\\n32\\n128" | dmenu -i -p "How many characters?") ; echo '') ;;
|
||||||
"Manual password") addPass=$(dmenu -i -P -p "Enter a password") ;;
|
"Manual password") addPass=$(dmenu -i -P -p "Enter a password") ;;
|
||||||
* ) exit
|
* ) exit
|
||||||
esac
|
esac
|
||||||
|
|
||||||
[ -z $addPass ] && exit
|
[ -z "$addPass" ] && exit
|
||||||
|
|
||||||
echo $addPass | pass insert "$name" -e
|
echo "$addPass" | pass insert "$name" -e
|
||||||
notify-send "🔒 Password for $name added!"
|
notify-send "🔒 Password for $name added!"
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
removePassword() { \
|
removePassword() { \
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user