Fix secondary bar launched for empty monitor name
This commit is contained in:
parent
98d2d6d05e
commit
cb88dd4f41
1 changed files with 10 additions and 5 deletions
|
@ -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>&-
|
||||
|
|
Loading…
Reference in a new issue