24 lines
540 B
Bash
24 lines
540 B
Bash
#!/usr/bin/env bash
|
|
(
|
|
flock 200
|
|
|
|
killall -q polybar
|
|
|
|
while pgrep -u $UID -x polybar > /dev/null; do sleep 0.5; done
|
|
|
|
monitors=$(polybar -m)
|
|
outputs=$(echo $monitors | cut -d ":" -f1)
|
|
tray_output=$(echo $monitor | grep primary | cut -d ":" -f 1)
|
|
|
|
for m in $outputs; do
|
|
export MONITOR=$m
|
|
export TRAY_POSITION=none
|
|
|
|
if [[ $m == "$tray_output" ]]; then
|
|
TRAY_POSITION=right
|
|
fi
|
|
|
|
polybar --reload main </dev/null >"/var/tmp/polybar-$m.log" 2>&1 200>&- &
|
|
disown
|
|
done
|
|
) 200>/var/tmp/polybar-launch.lock
|