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/bin/start-polybar

34 lines
880 B
Bash
Executable File

#!/usr/bin/env bash
# Enter your bar names here (seperated by spaces) eg BARS=(bar bar1 my-bar)
# This will be combined with CUR_WM eg. openbox-bar, bspwm-bar, i3-bar
BARS=(bar)
CONFIG=$HOME/.config/polybar/config
CUR_WM=$(xprop -root | grep "_NET_WM_NAME(UTF8_STRING)" | cut -d " " -f 3 | sed 's/"//g' | awk '{print tolower($0)}')
if [[ $1 == "--reload" ]] || [[ $1 == "-r" ]]; then
if [[ $CUR_WM == "openbox" ]]; then
openbox --restart
al-compositor --restart
al-tint2restart
else
echo "[WARN]: Option [--reload] is meant for Openbox..."
fi
fi
if pgrep -x "tint2" >/dev/null; then
echo "Tint is running... Exiting"
exit 1
fi
while pgrep -x polybar >/dev/null; do
killall -q polybar
sleep 0.5
done
echo "Using $CUR_WM... Launching Bars"
for bar in "${BARS[@]}"; do
polybar -r --config=$CONFIG ${CUR_WM}-$bar &
done
echo "Bars launched..."