mirror of
https://github.com/dcarrillo/dotfiles.git
synced 2024-12-22 17:28:01 +00:00
[polybar] Refactor launch.sh
This commit is contained in:
parent
61efb724a3
commit
11f8d701fe
@ -1,23 +1,40 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
pkill polybar
|
[ -f ~/.config/polybar/bar.env ] && . ~/.config/polybar/bar.env
|
||||||
pkill -f "task_manager --daemon"
|
|
||||||
while pgrep -u "$(id -u)" -x polybar >/dev/null; do
|
|
||||||
sleep 0.5;
|
|
||||||
done
|
|
||||||
|
|
||||||
export TERMINAL_CMD="tilix --profile orange --new-process -e"
|
export TERMINAL_CMD=${TERMINAL_CMD:-"tilix --profile orange --new-process -e"}
|
||||||
export WM_CONTROL="$(dirname "$0")/scripts/switch_window_state"
|
export WM_CONTROL=${WM_CONTROL:-"~/.config/polybar/scripts/switch_window_state"}
|
||||||
|
export TASKMANAGER_MAX_TASKS=${TASKMANAGER_MAX_TASKS:-20}
|
||||||
|
|
||||||
~/.config/polybar/scripts/task_manager --generate-config 20
|
function wait_for_polybar
|
||||||
|
{
|
||||||
|
condition=1
|
||||||
|
if [ "$1" = "stopped" ]; then
|
||||||
|
condition=0
|
||||||
|
fi
|
||||||
|
|
||||||
for monitor in $(polybar --list-monitors | cut -d":" -f1); do
|
while [ "$(pgrep -u "$(id -u)" -x polybar >/dev/null)" = $condition ]; do
|
||||||
|
sleep 0.2
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
function kill_polybar
|
||||||
|
{
|
||||||
|
pkill polybar
|
||||||
|
pkill -f "task_manager --daemon"
|
||||||
|
wait_for_polybar stopped
|
||||||
|
}
|
||||||
|
|
||||||
|
function launch_polybar
|
||||||
|
{
|
||||||
|
for monitor in $(polybar --list-monitors | cut -d":" -f1); do
|
||||||
export MONITOR=$monitor
|
export MONITOR=$monitor
|
||||||
polybar top -c ~/.config/polybar/bar.ini >/dev/null &
|
polybar top -c ~/.config/polybar/bar.ini >/dev/null &
|
||||||
done
|
done
|
||||||
|
wait_for_polybar started
|
||||||
until pgrep -u "$(id -u)" -x polybar >/dev/null; do
|
}
|
||||||
sleep 0.5
|
|
||||||
done
|
|
||||||
|
|
||||||
|
kill_polybar
|
||||||
|
~/.config/polybar/scripts/task_manager --generate-config "$TASKMANAGER_MAX_TASKS"
|
||||||
|
launch_polybar
|
||||||
~/.config/polybar/scripts/task_manager --daemon &
|
~/.config/polybar/scripts/task_manager --daemon &
|
||||||
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,2 +1,3 @@
|
|||||||
.config/polybar/task_manager.ini
|
.config/polybar/task_manager.ini
|
||||||
.config/polybar/modules-left.ini
|
.config/polybar/modules-left.ini
|
||||||
|
.config/polybar/bar.env
|
||||||
|
Loading…
Reference in New Issue
Block a user