#!/bin/sh

# toggle external monitor
# by lukesmithxyz, checkout github.com/lukesmithxyz/voidrice

intern=LVDS1
extern=HDMI2
(xrandr | grep "$extern disconnected")
(xrandr --listactivemonitors | grep $extern) || ((xrandr --output $extern --right-of $intern --auto && setbg) & exit)
(xrandr --listactivemonitors | grep $extern) && xrandr --output $extern --off
setbg