mobile-config-firefox: create userChrome.css symlink

This commit is contained in:
Oliver Smith 2020-08-06 16:25:22 +02:00
parent 016a9bb845
commit 87d4ae0ca3
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB
3 changed files with 46 additions and 2 deletions

View file

@ -0,0 +1,11 @@
[Desktop Entry]
Exec=mobile-config-firefox %u
Icon=firefox
Type=Application
Terminal=false
Name=Firefox
GenericName=Web Browser
MimeType=text/html;
StartupNotify=true
Categories=Network;WebBrowser;
StartupWMClass=firefox

View file

@ -0,0 +1,29 @@
#!/bin/sh
# Create chrome/userChrome.css symlink in a firefox profile dir
# $1: path to profile dir, e.g. "/home/user/.mozilla/firefox/asdf.default"
prepare_profile() {
mkdir -p "$1/chrome"
if ! [ -e "$1/chrome/userChrome.css" ]; then
ln -sv /etc/mobile-config-firefox/userChrome.css \
"$1/chrome/userChrome.css"
fi
}
profile_found=false
for profiledir in ~/.mozilla/firefox/*/; do
if ! [ -e "$profiledir/prefs.js" ]; then
continue
fi
prepare_profile "$profiledir"
profile_found=true
done
if [ "$profile_found" = "true" ]; then
exec firefox "$@"
else
profiledir=~/.mozilla/firefox/firefox.default
prepare_profile "$profiledir"
exec firefox --profile "$profiledir" "$@"
fi