2019-07-18 16:45:46 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2020-04-11 12:14:24 +00:00
|
|
|
[ -f ~/.config/polybar/bar.env ] && . ~/.config/polybar/bar.env
|
2019-07-18 16:45:46 +00:00
|
|
|
|
2023-09-30 15:35:44 +00:00
|
|
|
export TERMINAL_CMD=${TERMINAL_CMD:-"kitty --class=info --override='foreground=#c69026' "}
|
2024-04-22 14:19:20 +00:00
|
|
|
export BROWSER_CMD=${BROWSER_CMD:-"firefox"}
|
2020-04-11 12:14:24 +00:00
|
|
|
export WM_CONTROL=${WM_CONTROL:-"~/.config/polybar/scripts/switch_window_state"}
|
2020-07-03 18:08:19 +00:00
|
|
|
export ROFI_THEME=${ROFI_THEME:-orange}
|
2019-07-18 16:45:46 +00:00
|
|
|
|
2020-04-11 12:14:24 +00:00
|
|
|
function wait_for_polybar
|
|
|
|
{
|
|
|
|
condition=1
|
|
|
|
if [ "$1" = "stopped" ]; then
|
|
|
|
condition=0
|
|
|
|
fi
|
2020-04-10 14:17:05 +00:00
|
|
|
|
2020-04-11 12:14:24 +00:00
|
|
|
while [ "$(pgrep -u "$(id -u)" -x polybar >/dev/null)" = $condition ]; do
|
2024-06-15 19:21:20 +00:00
|
|
|
sleep 1
|
2020-04-11 12:14:24 +00:00
|
|
|
done
|
|
|
|
}
|
2019-07-18 16:45:46 +00:00
|
|
|
|
2020-04-11 12:14:24 +00:00
|
|
|
function kill_polybar
|
|
|
|
{
|
|
|
|
pkill polybar
|
|
|
|
wait_for_polybar stopped
|
|
|
|
}
|
2020-04-05 09:43:56 +00:00
|
|
|
|
2020-04-11 12:14:24 +00:00
|
|
|
function launch_polybar
|
|
|
|
{
|
|
|
|
for monitor in $(polybar --list-monitors | cut -d":" -f1); do
|
|
|
|
export MONITOR=$monitor
|
|
|
|
polybar top -c ~/.config/polybar/bar.ini >/dev/null &
|
|
|
|
done
|
|
|
|
wait_for_polybar started
|
|
|
|
}
|
|
|
|
|
|
|
|
kill_polybar
|
|
|
|
launch_polybar
|