os/arch (lemonbar): more error handling in panel bootstrap

This commit is contained in:
Henrik Lissner 2017-01-03 03:50:10 -05:00
parent a78820f469
commit 12a5de6de3

View file

@ -1,8 +1,11 @@
#!/usr/bin/env bash
if [ "$1" = "-k" ]; then
pkill -f '^bash .+/panel$'
if [[ "$1" = -k ]]; then
pkill -f '^[bd]ash .+/panel$'
exit
elif pgrep lemonbar >/dev/null; then
>&2 echo "Lemonbar is already running"
exit 1
fi
CWD=$(dirname $0)
@ -13,15 +16,10 @@ cleanup() { rm -rf "$PANEL_FIFO"; pkill -P $$; }
#
trap cleanup INT TERM QUIT EXIT
[ -e "$PANEL_FIFO" ] && rm "$PANEL_FIFO"
[ -e "$PANEL_FIFO" ] && rm -f "$PANEL_FIFO"
mkfifo "$PANEL_FIFO"
echo "MKFIFO $PANEL_FIFO"
if pgrep lemonbar >/dev/null; then
>&2 echo "Lemonbar is already running"
exit 1
fi
#
# Bootstrap panel(s)
@ -32,8 +30,10 @@ xtitle -sf 'X%s' > "${PANEL_FIFO}" &
bspc subscribe report > "${PANEL_FIFO}" &
for lemon in $CWD/lemons/*; do
echo "INIT ${lemon##*/}"
$lemon > "${PANEL_FIFO}" &
if [[ -f "$lemon" ]]; then
echo "INIT ${lemon##*/}"
$lemon > "${PANEL_FIFO}" &
fi
done
#