This repository has been archived on 2024-09-01. You can view files and clone it, but cannot push or open issues or pull requests.
al-skel/home/.config/polybar/scripts/launch-polybar

45 lines
1.0 KiB
Plaintext
Raw Normal View History

2017-10-16 14:38:02 -05:00
#!/usr/bin/env bash
# config location
CONF_PATH=$HOME/.config/polybar
# Check WM
cur_wm=$(wmctrl -m | grep Name | cut -d " " -f2)
if [[ $1 == --reload ]]; then
if ! [[ $cur_wm == i3 ]]; then
openbox --restart
al-compositor --restart
al-tint2restart
else
echo -e "WARN: Option [--reload] not meant for i3..\n\nUse [Super]+[Shift]+r to reload i3\n"
fi
fi
# Terminate already running bar instances
killall -q polybar
if pgrep -x "tint2" >/dev/null; then
echo "Tint is running, not launching bars"
exit 1
fi
# Wait until the processes have been shut down
while pgrep -u $UID -x polybar >/dev/null; do sleep 0.5; done
echo "WM is $cur_wm... Launching appropriate bars"
if [[ $cur_wm == i3 ]]; then # if i3 launch the i3-bar
polybar -r --config=$CONF_PATH/config i3-bar &
2017-10-23 18:35:35 -05:00
elif [[ $cur_wm == bspwm ]]; then # if bspwm launch the bsp-bar
polybar -r --config=$CONF_PATH/config bsp-bar &
2017-10-16 14:38:02 -05:00
else # otherwise we assume openbox
polybar -r --config=$CONF_PATH/config openbox-bar &
fi
echo "Bars launched..."