This repository has been archived on 2024-09-01. You can view files and clone it, but cannot push or open issues or pull requests.
al-skel/home/bin/toggle-caffeine
2017-12-01 23:06:11 -08:00

22 lines
387 B
Bash
Executable File

#!/usr/bin/env bash
# if the script is passed --toggle
if [[ "$1" == *toggle* ]]; then
if pgrep caffeine >/dev/null; then
killall caffeine
else
caffeine &>/dev/null &
fi
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