polybar: Change while read loop to an xargs pipe

This commit is contained in:
2025-12-10 14:27:53 +01:00
parent c46b1c5ea1
commit 2e2bad65a2

View File

@@ -22,10 +22,11 @@ done
if ! pgrep -ax polybar >/dev/null 2>&1; then
# launch Polybar on every monitor
# https://github.com/polybar/polybar/issues/763
while read -r m; do
export MONITOR="${m%%:*}"
polybar --reload -c "$BASE_DIR/config" main &
done <<<"$(polybar --list-monitors)"
polybar --list-monitors \
| cut -d: -f1 \
| xargs -I'{}' -P0 \
env MONITOR='{}' \
polybar --reload -c "$BASE_DIR/config" main &
echo "Polybar launched..."
else