aboutsummaryrefslogtreecommitdiff
path: root/yoga/bin/night-light
diff options
context:
space:
mode:
Diffstat (limited to 'yoga/bin/night-light')
-rwxr-xr-xyoga/bin/night-light14
1 files changed, 6 insertions, 8 deletions
diff --git a/yoga/bin/night-light b/yoga/bin/night-light
index 6c4224c..b76054d 100755
--- a/yoga/bin/night-light
+++ b/yoga/bin/night-light
@@ -1,5 +1,5 @@
#!/bin/bash
-# Usage: night-light [increase|decrease]
+# Usage: night-light [increase|decrease|day|night]
set -e
TMPFILE=/tmp/.night-light-index
@@ -20,18 +20,16 @@ STEPS=(
"1:1:1"
)
-CUR=${#STEPS[@]}
+CUR=$((${#STEPS[@]}-1))
if [ -f $TMPFILE ]; then
CUR=$(cat $TMPFILE)
fi
case "$1" in
- increase)
- NEW=$(($CUR >= ${#STEPS[@]} ? $CUR : $CUR+1))
- ;;
- decrease)
- NEW=$(($CUR <= 0 ? $CUR : $CUR-1))
- ;;
+ increase) NEW=$(($CUR >= ${#STEPS[@]} ? $CUR : $CUR+1)) ;;
+ decrease) NEW=$(($CUR <= 0 ? $CUR : $CUR-1)) ;;
+ day) NEW=$((${#STEPS[@]}-1)) ;;
+ night) NEW=0 ;;
*)
echo "Invalid argument '$1'"
exit 1