#!/bin/sh

CONDIS=$( xrandr|grep "connected ("|cut -f1-2 -d ' ' |grep -v VIRTUAL)
#WARN: reverse logic

if [ "$CONDIS" = "VGA1 connected" ]; then
 xrandr --output LVDS1 --off --output VGA1 --preferred
else
 xrandr --output LVDS1 --preferred --output VGA1 --off
fi
