From cb88dd4f41930ec773879ae5af5bc6b53f918ae9 Mon Sep 17 00:00:00 2001 From: M1dgard Date: Tue, 1 May 2018 16:15:49 +0200 Subject: [PATCH] Fix secondary bar launched for empty monitor name --- polybar/launch.sh | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/polybar/launch.sh b/polybar/launch.sh index 920199e..1ddf061 100755 --- a/polybar/launch.sh +++ b/polybar/launch.sh @@ -23,7 +23,11 @@ echo "Primary monitor: $primary" echo -e "\nDetermining secondary monitors..." 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 while pgrep -u $UID -x polybar >/dev/null; do sleep 1; done - echo "Terminated." ( @@ -56,9 +59,11 @@ echo "Terminated." start_polybar midbard "$primary" - while read -r monitor; do - start_polybar secondary "$monitor" - done <<< "$secondary" + if [[ -n $secondary ]]; then + while read -r monitor; do + start_polybar secondary "$monitor" + done <<< "$secondary" + fi ) exec 1>&- 2>&-