dotfiles/dot_local/bin/executable_launch_polybar

25 lines
540 B
Text
Raw Normal View History

2022-07-30 07:17:12 +02:00
#!/usr/bin/env bash
(
flock 200
killall -q polybar
while pgrep -u $UID -x polybar > /dev/null; do sleep 0.5; done
2022-10-19 07:06:29 +02:00
monitors=$(polybar -m)
outputs=$(echo $monitors | cut -d ":" -f1)
tray_output=$(echo $monitor | grep primary | cut -d ":" -f 1)
2022-07-30 07:17:12 +02:00
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