From da08e8288c455f94ddc41d299a656e8019edde87 Mon Sep 17 00:00:00 2001 From: Camil Staps Date: Mon, 20 Feb 2023 16:38:30 +0100 Subject: Add shortcuts to set night mode to day/night (extremes); change shortcuts for this and brightness --- yoga/bin/night-light | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'yoga/bin') 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 -- cgit v1.2.3