Browse Source

Add drm rules for monitor change event

pull/3/head
Ali Hatami Tajik 2 years ago
parent
commit
39a481eb56
  1. 1
      src/rules/90-drm.rules
  2. 12
      src/scripts/setupmonitor.sh

1
src/rules/90-drm.rules

@ -0,0 +1 @@
SUBSYSTEM=="drm", ENV{MONITOR_LOCK}="/tmp/monitorlock", ENV{SONOLOG}="/tmp/sonolog.log", RUN+="/usr/local/bin/setupmonitor.sh"

12
src/scripts/setupmonitor.sh

@ -0,0 +1,12 @@
#!/bin/bash
# This script will run when drm change event detected.
# This sctipt should be placed in /usr/local/bin
# SONOLOG file must be set beforehand in the udev rule
# MONITOR_LOCK should be set
(
flock -n 100 || exit 1
sleep 1 # wait until all changes take place
xrandr --auto
python3 /usr/bin/local/python/setupmonitor.py
echo $(data) - INFO - Setup Monitor Done >> $SONOLOG
) 100> $MONITOR_LOCK
Loading…
Cancel
Save