Which doesn’t seem to be working. I want it to run the bash script, which sets up the monitor correctly with scaling. I don’t see any change in the monitor setup when I plug or unplug
From my very little bash scripting, could you adjust your script to the following and test again if this script is working at all?
#!/usr/bin/env bash
...
if [ "$hdmi_active" = "HDMI1" ];
then
...
Edit: I just tested only the script and apparently you don’t have to change it and your script should already work, right? However, the [[ are not valid POSIX-sh and should be omitted.
Another edit:
My guess is that this script is not run as your current user but as root in an environment where xrandr doesn’t run because the DISPLAY variable is unset or it can’t access the xserver.
I have put it in a root directory /usr/local/bin so that the udev rule can run it. Any ideas on running it otherwise. If I cd into /usr/local/bin and run su which gives me root user access. I then run it as root user directly and not using sudo it still seems to work