When external HDMI display is connected, the internal display is automatically turned of. Suspending on lid close is turned off as well, so you can close laptop and continue to work.
When external display is disconnected, the internal display is turned back on, and suspending on lid close is restored as well.
First of all make sure that plugging external display provides udev
event.
Run udevadm monitor
. You should see some events logged when you plug in and plug out external display.
If so, your machine is ready for hotplug config.
- Create file
/etc/udev/rules.d/90-monitor-hotplug.rules
with content provided here.
Notice that
<USER>
should be substituted with actual user's name.
- Create file
~/bin/monitorhotplug.sh
with content provided here. - Make
monitorplug.sh
exectutable:chmod +x monitorplug.sh