Automatically adjust font scaling factor on monitor connect?

Answering myself as I was able to solve this: my problem was that the udev rule was running the script as root. Changing the udev rule to the following:

SUBSYSTEM=="drm", ACTION=="change", RUN+="/bin/su michaelmouf -c '/home/michaelmouf/bin/monitor-hotplug.sh'"

and moving the script to ~/bin and removing the sudo -us before the gsettings set commands did the trick!

1 Like