Skip to content

Instantly share code, notes, and snippets.

@amishurov
Created October 31, 2016 19:17
Show Gist options
  • Save amishurov/77cf780ff4f0958c742a7f9bef1be61b to your computer and use it in GitHub Desktop.
Save amishurov/77cf780ff4f0958c742a7f9bef1be61b to your computer and use it in GitHub Desktop.
hotplug second monitor
crude version of https://github.com/codingtony/udev-monitor-hotplug/blob/master/usr/local/bin/monitor-hotplug.sh
cat /usr/local/bin/hotplug_monitor.sh
#!/bin/bash
export XAUTHORITY=/home/USER/.Xauthority
export DISPLAY=:0.0
if [ $(cat /sys/class/drm/card0-VGA-1/status) == "connected" ]; then
/usr/bin/xrandr -d :0 --output VGA1 --right-of LVDS1 --auto
else
/usr/bin/xrandr -d :0 --output LVDS1 --auto
fi
cat /etc/udev/rules.d/99-monitor.rules
ACTION=="change", SUBSYSTEM=="drm", ENV{HOTPLUG}=="1", RUN+="/usr/local/bin/hotplug_monitor.sh"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment