-
Notifications
You must be signed in to change notification settings - Fork 3
/
launch.sh
executable file
·37 lines (29 loc) · 913 Bytes
/
launch.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/bash
# checkout https://github.com/polybar/polybar/issues/763#issuecomment-450940924
(
# prevent race conditions with a (f)lock
flock 200
# kill current instances of polybar
killall -q polybar
# make sure they're all dead
while pgrep -u $UID -x polybar > /dev/null; do sleep 0.2; done
# get the screens
outputs=$(xrandr --query | awk '/ connected/{ print $1 }')
# we want the tray to be consistently displayed on primary display
tray=$(xrandr --query | awk '/primary/{ print $1 }')
# iterate over outputs and setup the bar on them
for m in $outputs; do
export MONITOR=$m
if [[ $m == $tray ]]; then
BAR="primary-top"
else
BAR="secondary-top"
fi
polybar --reload "$BAR" </dev/null >/var/tmp/polybar-$m.log 2>&1 &
disown
done
snixembed >/var/tmp/snixembed.log 2>&1 &
disown
# unlock
flock -u 200
) 200>/var/tmp/polybar-launch.lock