Update and clean up user scripts
This commit is contained in:
@ -1,44 +1,21 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
|
||||
# if the script is passed --toggle
|
||||
if [[ "$1" == *toggle* ]]; then
|
||||
|
||||
# if caffeine is running kill it
|
||||
if pgrep caffeine >/dev/null; then
|
||||
|
||||
killall caffeine
|
||||
|
||||
else # otherwise start it and fork to background
|
||||
|
||||
else
|
||||
caffeine &>/dev/null &
|
||||
|
||||
fi
|
||||
|
||||
# exit or get caught in the infinite loop
|
||||
exit 0
|
||||
|
||||
fi
|
||||
|
||||
|
||||
# infinite loop for polybar
|
||||
while true; do
|
||||
|
||||
# caffeine is running
|
||||
if pgrep caffeine >/dev/null; then
|
||||
|
||||
# Change Me
|
||||
echo "%{F#0000FF}"
|
||||
|
||||
else # otherwise it must not be... LOL
|
||||
|
||||
# Change Me
|
||||
else
|
||||
echo "%{F#FF0000}"
|
||||
|
||||
fi
|
||||
|
||||
|
||||
# sleep interval... Change the responsiveness
|
||||
sleep 2
|
||||
|
||||
done
|
||||
|
Reference in New Issue
Block a user