Hi again ;)
I tried to write a plugin yesterday..what should I say..I failed ;) (thx for the good youtube video anyway)
So I came along with another solution (for now):
udev rules!
I have two simple udev rules, that monitors if a hdmi monitor is connected or disconnected and execute a script.
First find your env variables to identify the device:
georg@ideapad:~$ udevadm monitor --environment --udev
I got something like "ID_MODEL == "TS2GJF110"" which is unique on my system.
so here are our rules(/etc/udev/rules.d/70-hdmi.rules):
ACTION=="add", ENV{ID_MODEL}=="TS2GJF110", RUN+="/usr/local/bin/hdmi.sh"
ACTION=="remove", ENV{ID_MODEL}=="TS2GJF110", RUN+="/usr/local/bin/hdmi.sh"
Another good thing (for me) is that we can identify the device..so the rule only applies to my hdmi monitor, not the beamer at work ;-)
Hi again ;)
I tried to write a plugin yesterday..what should I say..I failed ;) (thx for the good youtube video anyway)
So I came along with another solution (for now):
udev rules!
I have two simple udev rules, that monitors if a hdmi monitor is connected or disconnected and execute a script.
First find your env variables to identify the device:
georg@ideapad:~$ udevadm monitor --environment --udev
I got something like "ID_MODEL == "TS2GJF110"" which is unique on my system.
so here are our rules(/ etc/udev/ rules.d/ 70-hdmi. rules): MODEL}= ="TS2GJF110" , RUN+="/ usr/local/ bin/hdmi. sh" MODEL}= ="TS2GJF110" , RUN+="/ usr/local/ bin/hdmi. sh"
ACTION=="add", ENV{ID_
ACTION=="remove", ENV{ID_
Another good thing (for me) is that we can identify the device..so the rule only applies to my hdmi monitor, not the beamer at work ;-)
my simple script:
#!/bin/sh
status="$(cat /sys/class/ drm/card0- HDMI-A- 1/status) "
export XAUTHORITY= /home/georg/ .Xauthority
export DISPLAY=:0.0
if [ "${status}" = disconnected ]
then
xrandr --output LVDS1 --auto --output HDMI-0 --off
elif [ "${status}" = connected ]
then
xrandr --output LVDS1 --off --output HDMI-0 --mode 1920x1080
fi
hope it helps someone until cuttlefish get a plugin for that action...since you can customize it a way better.