xrandr-auto (499B)
1 #!/bin/sh 2 3 # combine with the following: /etc/udev/rules.d/95-display.rules 4 # ACTION=="change", SUBSYSTEM=="drm", RUN+="/bin/su ad -c 'sleep 12; /home/ad/.local/bin/xrandr-auto'" 5 6 export DISPLAY=:0 7 export XAUTHORITY=$HOME/.Xauthority 8 9 internal_screen=LVDS1 10 external_screen=DP3 11 12 if xrandr -q | grep "^$external_screen connected" >/dev/null; then 13 xrandr --output $external_screen --auto --output $internal_screen --off 14 else 15 xrandr --output $internal_screen --auto --output $external_screen --off 16 fi