19 lines
390 B
Bash
Executable File
19 lines
390 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
# if the script is passed --toggle
|
|
if [[ $1 == *toggle* ]] && pgrep caffeine >/dev/null; then
|
|
killall caffeine && exit 0
|
|
elif [[ $1 == *toggle* ]]; then
|
|
caffeine &>/dev/null && exit 0
|
|
fi
|
|
|
|
while true; do
|
|
# caffeine is running
|
|
if pgrep caffeine >/dev/null; then
|
|
echo "%{F#0000FF}"
|
|
else
|
|
echo "%{F#FF0000}"
|
|
fi
|
|
sleep 2
|
|
done
|