Fix polybar script issue
This commit is contained in:
parent
ea01d6facd
commit
15c324b030
@ -1,10 +1,14 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if [ -e "$HOME/.config/.composite_enabled" ] && pgrep compton >/dev/null; then
|
||||
if [ -e "$HOME/.config/.composite_enabled" ] && [ "$(pidof compton)" ]; then
|
||||
al-compositor --restart
|
||||
elif [ -e "$HOME/.config/.composite_enabled" ]; then
|
||||
al-compositor --start
|
||||
else
|
||||
echo -e "Compositing in not enabled.. Requires ~/.config/.composite_enabled
|
||||
\n\nTry running paranoid and enabling compositing"
|
||||
echo "#Compositing enabled" > $HOME/.config/.composite_enabled
|
||||
if [ "$(pidof compton)" ]; then
|
||||
al-compositor --start
|
||||
else
|
||||
al-compositor --restart
|
||||
fi
|
||||
fi
|
||||
|
@ -17,6 +17,7 @@ HELP="\nUSAGE:\n\tstart-polybar [OPTIONS]
|
||||
\t--help, -h\tPrint this usage message and exit
|
||||
\n\tWith no options the script will stop and reload polybar"
|
||||
|
||||
# determine WM
|
||||
for i in ${WMS[@]}; do
|
||||
if [[ "$(wmctrl -m | grep -i name | awk '{print tolower($2)}')" == "$i" ]]; then
|
||||
WM=$i && break
|
||||
@ -27,32 +28,38 @@ for i in ${WMS[@]}; do
|
||||
fi
|
||||
done
|
||||
|
||||
# check if passed options
|
||||
case "$@" in
|
||||
*help|-h)
|
||||
echo -e $HELP && exit 0
|
||||
;;
|
||||
*reload|-r)
|
||||
if [[ "$CUR_WM" == "openbox" ]]; then
|
||||
if [[ "$WM" == "openbox" ]]; then
|
||||
openbox --restart
|
||||
al-compositor --restart && al-tint2restart
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
:
|
||||
;;
|
||||
esac
|
||||
|
||||
if pgrep tint2 >/dev/null; then
|
||||
echo "Tint is running... Exiting" && exit 0
|
||||
else
|
||||
while pgrep polybar >/dev/null; do
|
||||
|
||||
# bail if tint2 is running
|
||||
if [ "$(pidof tint2)" ]; then exit 0; fi
|
||||
|
||||
|
||||
# kill running bars
|
||||
while [ "$(pidof polybar)" ]; do
|
||||
pkill polybar && sleep 0.5
|
||||
done
|
||||
echo "Using $CUR_WM... Launching Bars"
|
||||
|
||||
|
||||
# launch bars
|
||||
for bar in "${BARS[@]}"; do
|
||||
polybar -r --config=$CONFIG ${CUR_WM}-$bar &
|
||||
polybar -r --config=$CONFIG ${WM}-$bar &
|
||||
done
|
||||
|
||||
if [ "$(pidof polybar)" ]; then
|
||||
echo "Bars launched..."
|
||||
else
|
||||
echo "Bars Failed to Launch"
|
||||
fi
|
||||
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
while pgrep polybar >/dev/null; do
|
||||
killall -q polybar && sleep 0.5
|
||||
done
|
||||
while [ "$(pidof polybar)" ]; do
|
||||
pkill polybar && sleep 0.5
|
||||
echo "Bars stopped..."
|
||||
done
|
||||
|
Reference in New Issue
Block a user