#!/bin/sh # toggle external monitor # by lukesmithxyz, checkout github.com/lukesmithxyz/voidrice [ -z "$INTERNAL_MONITOR" ] && intern="LVDS1" || intern="$EXTERNAL_MONITOR" [ -z "$EXTERNAL_MONITOR" ] && extern="HDMI2" || extern="$INTERNAL_MONITOR" case "$1" in toggle) (xrandr | grep "$extern disconnected") (xrandr --listactivemonitors | grep $extern) || ((xrandr --output $extern --right-of $intern --auto && wallpaper desktop) & exit) (xrandr --listactivemonitors | grep $extern) && xrandr --output $extern --off wallpaper desktop ;; *) cat << EOF monitor: cli script to enable and disable monitors. Allowed options: toggle Toggle the set monitor on and off all else Print this message EOF esac