handle disconnected monitors
This commit is contained in:
parent
2b2cab623f
commit
115b3c31f8
1 changed files with 7 additions and 2 deletions
|
@ -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}"
|
||||
|
|
Loading…
Reference in a new issue