2022-10-01 22:46:40 +02:00
|
|
|
#!/bin/sh
|
|
|
|
# speedwm_status
|
2022-10-27 17:41:42 +02:00
|
|
|
# status bar manager for speedwm/stellar
|
2022-10-01 22:46:40 +02:00
|
|
|
|
2022-10-27 17:41:42 +02:00
|
|
|
STATUSBAR="speedwm-stellar" # should be stellar
|
|
|
|
IN_ARGS="$@" # arguments
|
2022-11-12 11:44:36 +01:00
|
|
|
LOADTEXT="Loading" # load text
|
2022-10-27 17:41:42 +02:00
|
|
|
|
|
|
|
mkdir -p $HOME/.config/speedwm/
|
2022-10-01 22:46:40 +02:00
|
|
|
|
2022-11-16 21:23:47 +01:00
|
|
|
case "$1" in
|
|
|
|
"-h")
|
|
|
|
echo "speedwm_status - stellar launcher"
|
|
|
|
echo ""
|
|
|
|
echo "-r Restart stellar"
|
|
|
|
echo "No arguments Run stellar"
|
|
|
|
echo ""
|
|
|
|
echo "See speedwm-help for more information."
|
|
|
|
exit 0
|
|
|
|
;;
|
2022-11-18 18:13:09 +01:00
|
|
|
"-r")
|
|
|
|
pkill "$STATUSBAR" ; sleep 2 ; statusfunc
|
2022-11-16 21:23:47 +01:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2022-11-12 11:44:36 +01:00
|
|
|
# run status
|
|
|
|
rstatus() {
|
|
|
|
while true; do
|
|
|
|
$STATUSBAR $IN_ARGS > /tmp/statusbar-log
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
# run loop
|
2022-10-16 13:50:53 +02:00
|
|
|
statusfunc() {
|
2022-11-12 11:44:36 +01:00
|
|
|
if pgrep -x $STATUSBAR > /dev/null; then
|
|
|
|
clear
|
|
|
|
printf "Status bar is already running, continuing loop."
|
|
|
|
sleep 3
|
|
|
|
else
|
|
|
|
speedwm -s "$LOADTEXT"
|
|
|
|
rstatus
|
|
|
|
fi
|
|
|
|
|
2022-11-18 18:13:09 +01:00
|
|
|
# workaround for status crash when REFRESHDELAY is too low.
|
|
|
|
# this is fine since the status will be restarted anyway, but we don't need a core dump in $HOME.
|
|
|
|
if [ -e "$HOME/core" ]; then
|
|
|
|
rm -f "$HOME/core"
|
|
|
|
fi
|
|
|
|
|
2022-10-16 13:50:53 +02:00
|
|
|
statusfunc
|
|
|
|
}
|
2022-10-01 22:46:40 +02:00
|
|
|
|
2022-10-16 13:50:53 +02:00
|
|
|
statusfunc
|