I’m not sure about the udev rule, but it looks like it should work.
The script, however, has some problems. First, it has no shebang (#!/bin/bash
), so the kernel doesn’t know how to execute it. More significantly, udev is going to run it as root and outside your session.
Also, I don’t think this line is doing anything useful:
xrandr=$(xrandr)
I’d make a systemd user service and start that from the udev rule:
RUN+="/usr/bin/systemctl --user -M spurz@ start monitor-scale.service"
[Unit]
Description=Monitor scale adjustment
[Service]
Type=oneshot
ExecStart=/home/spurz/Documents/configs/monitor-scale
Save that as ~/.config/systemd/user/monitor-scale.service