add automagic firefox configuration

This commit is contained in:
randomuser 2022-07-02 16:30:27 -05:00
parent 1b2527f5db
commit b0168f8ace
3 changed files with 72 additions and 1 deletions

1
.gitignore vendored
View File

@ -1,4 +1,5 @@
.environment
.firefox_env
bash/hist
nvim/.netrwhist
bash/bash

View File

@ -1,7 +1,8 @@
LOCATION="$(HOME)/.config"
DATA="$(HOME)/.local/share"
install_local: install_bspwm install_nvim install_sx install_sxhkd install_zathura install_simplestatus install_bash install_ssh install_git install_tridactyl install_htop install_python
install_local: install_bspwm install_nvim install_sx install_sxhkd install_zathura install_simplestatus install_bash install_ssh install_git install_tridactyl install_htop install_python .firefox_env
install: .environment
install_bspwm:
ln -sf $(CURDIR)/bspwm $(LOCATION)/bspwm
install_nvim:
@ -28,3 +29,5 @@ install_python:
ln -sf $(CURDIR)/python $(LOCATION)/python
.environment:
sh environ
.firefox_env:
sh firefox_setup

67
firefox_setup Normal file
View File

@ -0,0 +1,67 @@
#!/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 umatrix.xpi tridactyl.xpi 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