Fix secondary bar launched for empty monitor name

This commit is contained in:
M1dgard 2018-05-01 16:15:49 +02:00
parent 98d2d6d05e
commit cb88dd4f41
Signed by untrusted user who does not match committer: midgard
GPG key ID: 511C112F1331BBB4

View file

@ -23,7 +23,11 @@ echo "Primary monitor: $primary"
echo -e "\nDetermining secondary monitors..." echo -e "\nDetermining secondary monitors..."
secondary="$(xrandr --listmonitors | sed -n "1d;/$primary\$/d;"'s/^.* \([^ ][^ ]*\)$/\1/p')" secondary="$(xrandr --listmonitors | sed -n "1d;/$primary\$/d;"'s/^.* \([^ ][^ ]*\)$/\1/p')"
echo "Secondary monitors:"; echo "$secondary" | sed -r 's/^/* /' if [[ -n $secondary ]]; then
echo "Secondary monitors:"; echo "$secondary" | sed -r 's/^/* /'
else
echo "No secondary monitors."
fi
@ -36,7 +40,6 @@ killall -q polybar
# Wait until the processes have been shut down # Wait until the processes have been shut down
while pgrep -u $UID -x polybar >/dev/null; do sleep 1; done while pgrep -u $UID -x polybar >/dev/null; do sleep 1; done
echo "Terminated." echo "Terminated."
( (
@ -56,9 +59,11 @@ echo "Terminated."
start_polybar midbard "$primary" start_polybar midbard "$primary"
while read -r monitor; do if [[ -n $secondary ]]; then
start_polybar secondary "$monitor" while read -r monitor; do
done <<< "$secondary" start_polybar secondary "$monitor"
done <<< "$secondary"
fi
) )
exec 1>&- 2>&- exec 1>&- 2>&-