try out a new firefox wrapper. maybe it will work?

This commit is contained in:
randomuser 2023-01-15 16:50:16 -06:00
parent 08e6b7a16c
commit 1196d79423
1 changed files with 41 additions and 0 deletions

41
sh/firew Executable file
View File

@ -0,0 +1,41 @@
#!/bin/sh
# wrapper script to make firefox suck less
RHOME="${HOME}"
firefox_data_location="$HOME/firefoxdumpster"
[ -z "$3" ] || url="$3"
# start a profile chooser
if [ -z "$2" ]; then
profile=$(printf "programming\nschool\ntmp-school\ntmp\nchromium\n" | tmenu)
else
profile="$2"
fi
[ -z "$profile" ] && exit
if [ "$profile" = "tmp" ]; then
# firefox doesn't start in a directory within /tmp
# so we create one in $HOME/.cache
tmp=$(basename $(mktemp))
mkdir -p "${RHOME}/.cache/${tmp}"
rm -r "/tmp/$tmp"
HOME="/home/$(whoami)/.local/share/firefox" firefox --profile "${RHOME}/.cache/${tmp}" --no-remote "$url"
rm -r "${RHOME}/.cache/${tmp}"
exit
fi
if [ "$profile" = "chromium" ]; then
HOME="/home/$(whoami)/.local/share/firefox" chromium
exit
fi
# start firefox
mkdir -p "${firefox_data_location}/profile"
HOME="/home/$(whoami)/.local/share/firefox" firefox --profile "${firefox_data_location}/${profile}" --no-remote "$url"
exit
printf "failed to specify a profile. exiting.\n"
exit 1