Ah, what you’re looking for is called udev. It supplies the system with device events from the linux kernel.
This gist of it is, to use this command
udevadm monitor --environment--udev
then unplug and plug in your monitor. You should see the events on screen. You then write a rule and place it in /etc/udev/rules.d. To run a script add something like
I’m familiar with udev rules. But it’s going to be more effort to write something that works with everything I might connect to than it is to just run xrandr each time. The way it is right now, it never fails and I don’t have to spend more than a minute tinkering with projector settings when I give a presentation.
Ah, what you’re looking for is called udev. It supplies the system with device events from the linux kernel.
This gist of it is, to use this command
udevadm monitor --environment --udevthen unplug and plug in your monitor. You should see the events on screen. You then write a rule and place it in /etc/udev/rules.d. To run a script add something like
ACTION=="change", SUBSYSTEM=="drm", KERNEL=="card0-HDMI-A-1", \ RUN+="/usr/local/monitor-script.sh"See the man udev page for more info (☞゚ヮ゚)☞
I’m familiar with udev rules. But it’s going to be more effort to write something that works with everything I might connect to than it is to just run xrandr each time. The way it is right now, it never fails and I don’t have to spend more than a minute tinkering with projector settings when I give a presentation.