multi monitor support; auto reload config

This commit is contained in:
2020-04-28 01:47:55 +02:00
parent 16dd765faa
commit 758b6e5713
2 changed files with 10 additions and 10 deletions

View File

@@ -10,7 +10,7 @@ secondary = #fff
alert = #f00
[bar/main]
monitor = eDP1
monitor = ${env:MONITOR}
bottom = false
fixed-center = true
width = 100%

View File

@@ -1,12 +1,12 @@
#!/bin/sh
# Terminate already running bar instances
killall -q polybar
# if there is no running instance
if ! pgrep -ax polybar >/dev/null 2>&1; then
# launch Polybar on every monitor
# https://github.com/polybar/polybar/issues/763#issuecomment-392960721
for m in $(polybar --list-monitors | cut -d':' -f1); do
MONITOR=$m polybar --reload -c "$HOME/.config/polybar/config" main &
done
# Wait until the processes have been shut down
while pgrep -x polybar >/dev/null; do sleep 1; done
# Launch Polybar
polybar -c "$HOME/.config/polybar/config" main &
echo "Polybar launched..."
echo "Polybar launched..."
fi