better functionality

This commit is contained in:
tavo-wasd 2024-08-25 12:39:55 -06:00
parent 35d62e92e9
commit 4d94f87790

View file

@ -1,12 +1,13 @@
#!/bin/sh #!/bin/sh
LIST="$(xrandr | sed '/disconnected/d;/connected/!d;s/ .*$//g')" LIST=`xrandr | sed '/ connected/!d;s/ .*$//'`
MONITORS="$(printf '%s' "$LIST" | tr '\n' ' ')" MONITORS=`printf '%s' "${LIST}" | tr '\n' ' '`
CMD="$(printf 'xrandr' ; for MONITOR in $MONITORS ; do CMD="$(FIRST=1 ; for i in ${MONITORS} ; do
SELECT="$(printf '%s' "$LIST" | menu "Next monitor (to right):")" CURR=`printf '%s' "${LIST}" | sed "/${LAST:=empty}/d" | menu "Next monitor (to right):"`
[ -z "$SELECT" ] && exit 0 [ -z "${CURR}" ] && exit 0
[ -n "$LAST" ] && printf ' --output %s --right-of %s' "$SELECT" "$LAST" [ "${FIRST}" ] && printf 'xrandr --output %s' "${CURR}" && FIRST=
LAST="$SELECT" [ "${LAST}" ] && printf ' --left-of %s' "${CURR}"
LAST="${CURR}"
done)" done)"
$($CMD) $($CMD)