2019-07-11 19:58:40 +03:00
|
|
|
#!/bin/bash
|
|
|
|
|
2019-07-13 15:47:43 +03:00
|
|
|
THEMEDIRECTORY=$(cd `dirname $0` && cd .. && pwd)
|
2019-07-17 21:33:41 +03:00
|
|
|
FIREFOXFOLDER=~/.mozilla/firefox
|
2019-07-11 19:58:40 +03:00
|
|
|
PROFILENAME=""
|
|
|
|
GNOMISHEXTRAS=false
|
|
|
|
|
2019-07-12 19:07:20 +03:00
|
|
|
# Get options.
|
2019-07-11 19:58:40 +03:00
|
|
|
while getopts 'f:p:g' flag; do
|
|
|
|
case "${flag}" in
|
|
|
|
f) FIREFOXFOLDER="${OPTARG}" ;;
|
|
|
|
p) PROFILENAME="${OPTARG}" ;;
|
|
|
|
g) GNOMISHEXTRAS=true ;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
2019-07-12 19:07:20 +03:00
|
|
|
# Define profile folder path.
|
2019-07-11 19:58:40 +03:00
|
|
|
if test -z "$PROFILENAME"
|
|
|
|
then
|
2019-07-17 21:33:41 +03:00
|
|
|
PROFILEFOLDER="$FIREFOXFOLDER/*.default*"
|
2019-07-11 19:58:40 +03:00
|
|
|
else
|
2019-07-12 19:07:20 +03:00
|
|
|
PROFILEFOLDER="$FIREFOXFOLDER/$PROFILENAME"
|
2019-07-11 19:58:40 +03:00
|
|
|
fi
|
|
|
|
|
2019-07-12 19:07:20 +03:00
|
|
|
# Enter Firefox profile folder.
|
2019-07-18 01:38:26 +03:00
|
|
|
if ! cd $PROFILEFOLDER ; then
|
2019-07-24 01:53:01 +03:00
|
|
|
echo "Error entering profile folder."
|
2019-07-18 01:38:26 +03:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2019-07-12 19:07:20 +03:00
|
|
|
echo "Installing theme in $PWD"
|
|
|
|
|
|
|
|
# Create a chrome directory if it doesn't exist.
|
|
|
|
mkdir -p chrome
|
|
|
|
cd chrome
|
|
|
|
|
2019-07-13 15:47:43 +03:00
|
|
|
# Copy theme repo inside
|
2020-04-10 16:59:47 +03:00
|
|
|
echo "Copying repo in $PWD"
|
2019-07-13 15:47:43 +03:00
|
|
|
cp -R $THEMEDIRECTORY $PWD
|
2019-07-11 19:58:40 +03:00
|
|
|
|
2019-07-13 15:47:43 +03:00
|
|
|
# Create single-line user CSS files if non-existent or empty.
|
2019-07-12 19:07:20 +03:00
|
|
|
[[ -s userChrome.css ]] || echo >> userChrome.css
|
2019-07-11 19:58:40 +03:00
|
|
|
|
2019-07-13 15:47:43 +03:00
|
|
|
# Import this theme at the beginning of the CSS files.
|
2019-07-12 19:07:20 +03:00
|
|
|
sed -i '1s/^/@import "firefox-gnome-theme\/userChrome.css";\n/' userChrome.css
|
|
|
|
|
2019-07-13 15:47:43 +03:00
|
|
|
# If GNOMISH extras enabled, import it in customChrome.css.
|
2019-07-11 19:58:40 +03:00
|
|
|
if [ "$GNOMISHEXTRAS" = true ] ; then
|
2019-07-12 19:07:20 +03:00
|
|
|
echo "Enabling GNOMISH extra features"
|
2019-07-24 01:53:01 +03:00
|
|
|
[[ -s customChrome.css ]] || echo >> firefox-gnome-theme/customChrome.css
|
2019-07-12 19:07:20 +03:00
|
|
|
sed -i '1s/^/@import "theme\/hide-single-tab.css";\n/' firefox-gnome-theme/customChrome.css
|
|
|
|
sed -i '2s/^/@import "theme\/matching-autocomplete-width.css";\n/' firefox-gnome-theme/customChrome.css
|
2019-09-10 02:25:07 +03:00
|
|
|
sed -i '3s/^/@import "theme\/rounded-title-buttons.css";\n/' firefox-gnome-theme/customChrome.css
|
2019-07-11 19:58:40 +03:00
|
|
|
fi
|
2019-07-12 19:07:20 +03:00
|
|
|
|
2019-07-12 19:38:16 +03:00
|
|
|
# Symlink user.js to firefox-gnome-theme one.
|
|
|
|
echo "Set configuration user.js file"
|
2019-07-12 19:45:29 +03:00
|
|
|
ln -s chrome/firefox-gnome-theme/configuration/user.js ../user.js
|
2019-07-12 19:38:16 +03:00
|
|
|
|
2019-07-12 19:07:20 +03:00
|
|
|
echo "Done."
|