• 0 Posts
  • 1 Comment
Joined 3 years ago
cake
Cake day: June 26th, 2023

help-circle
  • 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

    ACTION=="change", SUBSYSTEM=="drm", KERNEL=="card0-HDMI-A-1", \
      RUN+="/usr/local/monitor-script.sh"
    

    See the man udev page for more info (☞゚ヮ゚)☞