dotfiles/polybar/launch.sh

27 lines
707 B
Bash
Raw Normal View History

2020-08-03 18:59:39 +00:00
#!/usr/bin/sh
2020-08-01 14:46:05 +00:00
## Add this to your wm startup file.
# Terminate already running bar instances
2020-08-03 18:59:39 +00:00
#killall -q polybar
2020-08-01 14:46:05 +00:00
# Wait until the processes have been shut down
2020-08-03 18:59:39 +00:00
#while pgrep -u $UID -x polybar >/dev/null; do sleep 1; done
2020-08-01 14:46:05 +00:00
# Launch bar1 and bar2
2020-08-03 18:59:39 +00:00
#polybar main -c ~/.config/polybar/config.ini &
if [ -z "`pgrep -x polybar`" ]; then
BAR="main"
#Detect if DP or internal laptop displays are connected and show a polybar for them
#TODO look at the other laptop for the name of the HDMI output
2020-11-05 08:26:43 +00:00
for m in $(polybar -m | grep "\(HDMI\|DP\|LVDS\|eDP\|DisplayPort\)" | cut -d ':' -f1); do
2020-08-03 18:59:39 +00:00
MONITOR=$m
polybar --reload $BAR -c ~/.config/polybar/config.ini &
sleep 1
done
else
polybar-msg cmd restart
fi