Change Firefox's zoom by script
Each time I change the monitor I have to zoom in or out firefox. Here’s how to set it via script:

Figure 1: Large

Figure 2: Small
Locate the appropriate file
ls /home/*/.mozilla/firefox/*/prefs.jsLocate the appropriate parameter
grep layout.css.devPixelsPerPx /home/*/.mozilla/firefox/*/prefs.jsLarge screen: Set the zoom
#!/usr/bin/env bash
factor=2.5
if grep 'layout.css.devPixelsPerPx' /home/*/.mozilla/firefox/*/prefs.js
then
sed -i -e "s/^user_pref(\"layout.css.devPixelsPerPx.*$/user_pref(\"layout.css.devPixelsPerPx\", \"$factor\");/" /home/*/.mozilla/firefox/*/prefs.js
else
echo "user_pref(\"layout.css.devPixelsPerPx\", \"$factor\");" >> /home/*/.mozilla/firefox/*/prefs.js
fiSmall screen: Set the zoom
#!/usr/bin/env bash
factor=1.0
if grep 'layout.css.devPixelsPerPx' /home/*/.mozilla/firefox/*/prefs.js
then
sed -i -e "s/^user_pref(\"layout.css.devPixelsPerPx.*$/user_pref(\"layout.css.devPixelsPerPx\", \"$factor\");/" /home/*/.mozilla/firefox/*/prefs.js
else
echo "user_pref(\"layout.css.devPixelsPerPx\", \"$factor\");" >> /home/*/.mozilla/firefox/*/prefs.js
fiMake the scripts executable
sudo chmod --verbose +x ~/src/scripts/FirefoxZoomIn.sh
sudo chmod --verbose +x ~/src/scripts/FirefoxZoomOut.sh~/src/scripts/FirefoxZoomIn.sh~/src/scripts/FirefoxZoomOut.shDocking/undocking triggers those scripts, which I’m handling with Autorandr.