xrandr Notes:

default

 
if (xrandr | grep "VGA-0"); then echo "yes"; fi
# Check to see if external monitor is connected

if [[ $(xrandr | awk '/VGA-0/ {print $2}') == 'connected' ]]; then echo 'yes'; else echo 'no'; fi
# Another way to see if external monitor is connected
# These examples are using: zsh

if [[ $(xrandr | awk '/VGA-0/ {print $2}') == 'connected' ]]; then
xrandr --output VGA-0 --auto --eft-of eDP
#else echo 'no';
fi
# Connect VGA monitor to laptop if it is connected
# Can be added to .xintrc to auto add an external VGA monitor

default