pimp xrandr script
This commit is contained in:
parent
4d94f87790
commit
120dbfd338
1 changed files with 15 additions and 5 deletions
|
@ -1,13 +1,23 @@
|
|||
#!/bin/sh
|
||||
LIST=`xrandr | sed '/ connected/!d;s/ .*$//'`
|
||||
MONITORS=`printf '%s' "${LIST}" | tr '\n' ' '`
|
||||
LIST="$(xrandr | sed '/ connected/!d;s/ .*$//')"
|
||||
MONITORS="$(printf '%s' "${LIST}" | tr '\n' ' ')"
|
||||
MIRR="$(printf 'Yes\nNo' | menu "Mirror monitors?:")"
|
||||
|
||||
CMD="$(FIRST=1 ; for i in ${MONITORS} ; do
|
||||
CURR=`printf '%s' "${LIST}" | sed "/${LAST:=empty}/d" | menu "Next monitor (to right):"`
|
||||
[ "${MIRR}" = "Yes" ] && CMD="$(FIRST=1 ; for i in ${MONITORS} ; do
|
||||
CURR="${i}"
|
||||
[ "${FIRST}" ] && printf 'xrandr --output %s' "${CURR}" && FIRST=
|
||||
[ "${LAST}" ] && printf ' --same-as %s' "${CURR}"
|
||||
LAST="${CURR}"
|
||||
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
|
||||
[ "${FIRST}" ] && printf 'xrandr --output %s' "${CURR}" && FIRST=
|
||||
[ "${LAST}" ] && printf ' --left-of %s' "${CURR}"
|
||||
LAST="${CURR}"
|
||||
done)"
|
||||
|
||||
$($CMD)
|
||||
CMD="xrandr --auto && $CMD"
|
||||
[ "${CMD}" ] && eval "${CMD}"
|
||||
printf '%s' "${CMD}"
|
||||
|
|
Loading…
Reference in a new issue