aboutsummaryrefslogtreecommitdiff
path: root/yoga/bin
diff options
context:
space:
mode:
authorCamil Staps2023-02-20 16:38:30 +0100
committerCamil Staps2023-02-20 16:38:30 +0100
commitda08e8288c455f94ddc41d299a656e8019edde87 (patch)
treef50d75bd703146c9bedeaa2b9fa919d330d07840 /yoga/bin
parentAdd night light shortcuts (diff)
Add shortcuts to set night mode to day/night (extremes); change shortcuts for this and brightness
Diffstat (limited to 'yoga/bin')
-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