diff --git a/scripts/menu/menu-xrandr b/scripts/menu/menu-xrandr index 1b96021..24b473b 100755 --- a/scripts/menu/menu-xrandr +++ b/scripts/menu/menu-xrandr @@ -2,10 +2,15 @@ LIST="$(xrandr | sed '/ connected/!d;s/ .*$//')" MONITORS="$(printf '%s' "${LIST}" | tr '\n' ' ')" MIRR="$(printf 'Yes\nNo' | menu "Mirror monitors?:")" +ULIST="$(xrandr | sed '/ disconnected/!d;s/ .*$//')" + +for i in ${ULIST} ; do + UNSET="${UNSET} --output ${i} --off" +done [ "${MIRR}" = "Yes" ] && CMD="$(FIRST=1 ; for i in ${MONITORS} ; do CURR="${i}" - [ -z "${CURR}" ] && exit 0 + [ -z "${CURR}" ] && exit 1 [ "${FIRST}" ] && printf 'xrandr --output %s' "${CURR}" && FIRST= [ "${LAST}" ] && printf ' --same-as %s' "${CURR}" LAST="${CURR}" @@ -13,7 +18,7 @@ done)" ! [ "${CMD}" ] && CMD="$(FIRST=1 ; for i in ${MONITORS} ; do CURR="$(printf '%s' "${LIST}" | sed "/${LAST:=empty}/d" | menu "Next monitor (to right):")" - [ -z "${CURR}" ] && exit 0 + [ -z "${CURR}" ] && exit 1 [ "${FIRST}" ] && printf 'xrandr --output %s' "${CURR}" && FIRST= [ "${LAST}" ] && printf ' --left-of %s' "${CURR}" LAST="${CURR}"