Saturday, January 04, 2014

Script to set Firefox zoom/dpi/devPixelsPerPx on the command line


#!/bin/bash

PREF=~/.mozilla/firefox/*.default*/prefs.js
BAK="$PREF.bak"
SETTING="layout.css.devPixelsPerPx"

CURR=$(grep $SETTING $PREF)

cp $PREF $BAK
grep -v $SETTING $BAK > $PREF
echo "user_pref(\"$SETTING\", \"$1\");" >> $PREF

/usr/bin/firefox

cp $PREF $BAK
grep -v $SETTING $BAK > $PREF
echo $CURR >> $PREF