33 lines
1.0 KiB
Bash
Executable File
33 lines
1.0 KiB
Bash
Executable File
#! /bin/zsh
|
|
|
|
echo "-------------------------------------"
|
|
echo "Browser Setup Script"
|
|
echo "-------------------------------------"
|
|
|
|
echo "Checking if firefox is already synced"
|
|
if [[ -d "$HOME/.mozilla/firefox" && -n "$(find "$HOME/.mozilla/firefox" -name "places.sqlite" -print -quit)" ]]; then
|
|
echo "Firefox profile detected. Skipping sync."
|
|
exit 0
|
|
fi
|
|
|
|
FIREFOX=$(enpass-cli -vault="$HOME/.local/share/Enpass/Enpass/Vaults/primary" -json -sort show "Firefox" | sed 's/\\/\\\\/g') # Escaping backslashes for jq
|
|
FIREFOXUN=$(echo "$FIREFOX" | jq -r '.[].login')
|
|
FIREFOXPW=$(echo "$FIREFOX" | jq -r '.[].password')
|
|
|
|
echo -n "$FIREFOXUN" | wl-copy
|
|
|
|
station-launch-browser "https://accounts.firefox.com/signin?action=email&service=sync"
|
|
|
|
zenity --title="Firefox Setup" \
|
|
--info \
|
|
--text="Email copied.\nPress OK for password" \
|
|
|| gum confirm "You closed the dialog, do you want to continue?" \
|
|
|| exit 1
|
|
|
|
echo -n "$FIREFOXPW" | wl-copy
|
|
|
|
read -s -k $'?Press enter when you have synced Firefox...\n'
|
|
|
|
echo -n "" | wl-copy
|
|
|