os/arch (lemonbar): more error handling in panel bootstrap
This commit is contained in:
parent
a78820f469
commit
12a5de6de3
|
@ -1,8 +1,11 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
if [ "$1" = "-k" ]; then
|
if [[ "$1" = -k ]]; then
|
||||||
pkill -f '^bash .+/panel$'
|
pkill -f '^[bd]ash .+/panel$'
|
||||||
exit
|
exit
|
||||||
|
elif pgrep lemonbar >/dev/null; then
|
||||||
|
>&2 echo "Lemonbar is already running"
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
CWD=$(dirname $0)
|
CWD=$(dirname $0)
|
||||||
|
@ -13,15 +16,10 @@ cleanup() { rm -rf "$PANEL_FIFO"; pkill -P $$; }
|
||||||
|
|
||||||
#
|
#
|
||||||
trap cleanup INT TERM QUIT EXIT
|
trap cleanup INT TERM QUIT EXIT
|
||||||
[ -e "$PANEL_FIFO" ] && rm "$PANEL_FIFO"
|
[ -e "$PANEL_FIFO" ] && rm -f "$PANEL_FIFO"
|
||||||
mkfifo "$PANEL_FIFO"
|
mkfifo "$PANEL_FIFO"
|
||||||
echo "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)
|
# Bootstrap panel(s)
|
||||||
|
@ -32,8 +30,10 @@ xtitle -sf 'X%s' > "${PANEL_FIFO}" &
|
||||||
bspc subscribe report > "${PANEL_FIFO}" &
|
bspc subscribe report > "${PANEL_FIFO}" &
|
||||||
|
|
||||||
for lemon in $CWD/lemons/*; do
|
for lemon in $CWD/lemons/*; do
|
||||||
echo "INIT ${lemon##*/}"
|
if [[ -f "$lemon" ]]; then
|
||||||
$lemon > "${PANEL_FIFO}" &
|
echo "INIT ${lemon##*/}"
|
||||||
|
$lemon > "${PANEL_FIFO}" &
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
#
|
#
|
||||||
|
|
Loading…
Reference in a new issue