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