1
0
mirror of https://github.com/dcarrillo/dotfiles.git synced 2024-12-24 17:36:47 +00:00
dotfiles/.config/polybar/launch.sh

41 lines
1018 B
Bash
Raw Normal View History

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
2020-04-11 12:14:24 +00:00
export TERMINAL_CMD=${TERMINAL_CMD:-"tilix --profile orange --new-process -e"}
export WM_CONTROL=${WM_CONTROL:-"~/.config/polybar/scripts/switch_window_state"}
export TASKMANAGER_MAX_TASKS=${TASKMANAGER_MAX_TASKS:-20}
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-11 12:14:24 +00:00
while [ "$(pgrep -u "$(id -u)" -x polybar >/dev/null)" = $condition ]; do
sleep 0.2
done
}
2019-07-18 16:45:46 +00:00
2020-04-11 12:14:24 +00:00
function kill_polybar
{
pkill polybar
pkill -f "task_manager --daemon"
wait_for_polybar stopped
}
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
~/.config/polybar/scripts/task_manager --generate-config "$TASKMANAGER_MAX_TASKS"
launch_polybar
~/.config/polybar/scripts/task_manager --daemon &