summaryrefslogtreecommitdiff
path: root/.local/bin/statusbar/polybar_panel
blob: 76a7cc27edb61b557045dab051a043d6ac21347f (plain)
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
#!/bin/sh

# Terminate already running bar instances
killall -q polybar

# Wait until the processes have been shut down
while pgrep -u "$(id -ru)" -x polybar >/dev/null; do sleep 1; done

# Launch bar1 and bar2
bar1=main
bar2=second
echo "---" | tee -a /tmp/$bar1.log /tmp/$bar2.log

polybar --reload $bar1 >> /tmp/$bar1.log 2>&1 & disown
polybar --reload $bar2 >> /tmp/$bar2.log 2>&1 & disown

# To display the same bar on multiple monitors.
# if type "xrandr"; then
#   for m in $(xrandr --query | grep " connected" | cut -d" " -f1); do
#     MONITOR=$m polybar --reload example &
#   done
# else
#   polybar --reload example &
# fi

# Taken from another script, this is for when
# a new monitor is connected, I guess?
# externo=$(xrandr --query | grep "HDMI1")
# if [ ! "$externo" = "*disconnected*" ]; then
#   MONITOR="HDMI1" polybar --reload $bar2 -c ~/.config/polybar/config >>/tmp/$bar2.log 2>&1 &
# fi

echo "Bars launched..."