23 lines
464 B
Bash
Executable File
23 lines
464 B
Bash
Executable File
#!/usr/bin/env bash
|
|
STATEFILE="/tmp/stop-screensaver.state"
|
|
LABEL="stop-scr"
|
|
ICON_ON=""
|
|
ICON_OFF=""
|
|
|
|
if [ -f "$STATEFILE" ]; then
|
|
state=$(cat "$STATEFILE")
|
|
else
|
|
state=""
|
|
fi
|
|
|
|
# fallback проверка процесса, если statefile отсутствует/неактуален
|
|
if pgrep -f "/usr/local/bin/stop-screensaver.sh" >/dev/null; then
|
|
state="running"
|
|
fi
|
|
|
|
if [ "$state" = "running" ]; then
|
|
echo " $ICON_ON "
|
|
else
|
|
echo " $ICON_OFF "
|
|
fi
|