2017-12-01 00:21:33 -06:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2017-12-05 21:50:28 -06:00
|
|
|
#
|
|
|
|
# Polybar launcher script written by Nathaniel Maia for use in ArchLabs
|
|
|
|
# Will launch bars depending on WM
|
|
|
|
# Can also be used to reload openbox session with [--reload] or [-r]
|
|
|
|
|
|
|
|
|
2017-12-01 00:21:33 -06:00
|
|
|
# Enter your bar names here (seperated by spaces) eg BARS=(bar bar1 my-bar)
|
2017-12-02 01:06:11 -06:00
|
|
|
# This will be combined with CUR_WM eg. openbox-bar, bspwm-bar, i3-bar
|
2017-12-01 00:21:33 -06:00
|
|
|
BARS=(bar)
|
2017-12-02 01:06:11 -06:00
|
|
|
CONFIG=$HOME/.config/polybar/config
|
2017-12-05 21:50:28 -06:00
|
|
|
|
|
|
|
|
|
|
|
if [[ "$(xprop -root | grep -i "openbox")" > /dev/null ]]; then
|
|
|
|
CUR_WM="openbox"
|
|
|
|
else
|
|
|
|
CUR_WM=$(xprop -root | grep "_NET_WM_NAME(UTF8_STRING)" | cut -d " " -f 3 | sed 's/"//g' | awk '{print tolower($0)}')
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Reload openbox session
|
|
|
|
if [[ $1 == "--reload" ]] && [[ $CUR_WM == "openbox" ]]; then
|
2017-12-01 00:21:33 -06:00
|
|
|
openbox --restart
|
|
|
|
al-compositor --restart
|
|
|
|
al-tint2restart
|
2017-12-05 21:50:28 -06:00
|
|
|
elif [[ $1 == "--reload" ]]; then
|
|
|
|
echo "[WARN]: Option [--reload] is meant for Openbox Only"
|
2017-12-01 00:21:33 -06:00
|
|
|
fi
|
|
|
|
|
2017-12-05 21:50:28 -06:00
|
|
|
# Drop out if tint2 is running
|
|
|
|
if pgrep tint2 >/dev/null; then
|
|
|
|
echo "Tint2 is running... Exiting"
|
|
|
|
exit 0
|
2017-12-01 00:21:33 -06:00
|
|
|
fi
|
|
|
|
|
2017-12-05 21:50:28 -06:00
|
|
|
# Terminate already running Bars
|
|
|
|
while pgrep polybar >/dev/null; do
|
2017-12-01 00:21:33 -06:00
|
|
|
killall -q polybar
|
|
|
|
sleep 0.5
|
|
|
|
done
|
|
|
|
|
2017-12-05 21:50:28 -06:00
|
|
|
# Launch each bar in BARS=() above
|
2017-12-01 00:21:33 -06:00
|
|
|
echo "Using $CUR_WM... Launching Bars"
|
|
|
|
for bar in "${BARS[@]}"; do
|
2017-12-02 01:06:11 -06:00
|
|
|
polybar -r --config=$CONFIG ${CUR_WM}-$bar &
|
2017-12-01 00:21:33 -06:00
|
|
|
done
|
|
|
|
echo "Bars launched..."
|