dot_testing/firefox_setup
2022-07-15 16:35:22 -05:00

68 lines
1.9 KiB
Bash

#!/bin/sh
verb=0
# hooboy this is going to be complicated
# strap in
get_xpi_for_ext() {
# $1 -- extension name in the store url
# $2 -- download location
search_for="$(printf %s "$1" | sed 's/-/_/g')"
final_url=$(curl -s "https://addons.mozilla.org/en-US/firefox/addon/$1/" |
sed 's|\u002F|/|g' |
grep -o "https://addons.mozilla.org/firefox/downloads/file/[[:digit:]]*/"${search_for}"-.[0-9\.]*.xpi")
[ "$verb" -eq 0 ] && printf "downloaded extension %s\n" "$final_url"
curl -s "$final_url" -o "$2"
}
get_xpi_for_ext "umatrix" "firefox/umatrix.xpi"
get_xpi_for_ext "tridactyl-vim" "firefox/tridactyl.xpi"
get_xpi_for_ext "gruvbox-dark" "firefox/gruvbox.xpi"
# generate the firefox profile directory
# assumes you have the randomuser/utils repo installed
# if not, maybe do that
[ "$verb" -eq 0 ] && printf "opening firefox, don't focus away\n"
fire &
sleep 10
xdotool key ctrl+t
xdotool key ctrl+l
xdotool type "https://example.com"
xdotool key Return
sleep 3
for i in $(shuf -i 0-5 | tr '\n' ' '); do
xdotool key 'ctrl+w'
done
cd ~/.local/share/firefox/.mozilla/firefox
cd "$(ls | grep 'default-esr$')"
pwd
git clone https://github.com/arkenfox/user.js gituser.js
sed -i "18d;19i cd $(pwd)" gituser.js/prefsCleaner.sh
HOME="/home/usr/.local/share/firefox/" bash gituser.js/prefsCleaner.sh
HOME="/home/usr/.local/share/firefox/" bash gituser.js/updater.sh -l
cd /home/usr/git/dot/firefox
printf "Please install all the extensions, then close all windows in the browser.\n"
fire https://example.com $(pwd)/umatrix.xpi $(pwd)/tridactyl.xpi $(pwd)/gruvbox.xpi
curl -fsSl https://raw.githubusercontent.com/tridactyl/native_messenger/master/installers/install.sh -o /tmp/trinativeinstall.sh && HOME="/home/usr/.local/share/firefox" sh /tmp/trinativeinstall.sh 1.22.1
fire &
sleep 5
xdotool key ctrl+l
xdotool type "https://example.com"
xdotool key Return
# we're done, finally.
# touch a hidden file so the makefile knows we're done
touch .firefox_env