utils/sh/firew

42 lines
1010 B
Bash
Executable File

#!/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