aboutsummaryrefslogtreecommitdiff
path: root/i3/red-shift.sh
diff options
context:
space:
mode:
authorAargh Rai <aargh.rai+git@gmail.com>2026-09-20 16:38:38 +0530
committerAargh Rai <aargh.rai+git@gmail.com>2026-09-20 16:38:38 +0530
commitdd2b49db4b45feb6eed5b73cdf7f3fe5a843550b (patch)
tree9aeeb9f969323929755aa115962f55333f8698b6 /i3/red-shift.sh
parent698c8a407637724a85c9e24d87a359e364e4c51c (diff)
xrandr replaced by gammastep for night lightHEADmaster
Diffstat (limited to 'i3/red-shift.sh')
-rwxr-xr-xi3/red-shift.sh36
1 files changed, 14 insertions, 22 deletions
diff --git a/i3/red-shift.sh b/i3/red-shift.sh
index bb847e6..4d311c7 100755
--- a/i3/red-shift.sh
+++ b/i3/red-shift.sh
@@ -1,31 +1,23 @@
#!/usr/bin/env bash
-OUTPUT="eDP-1-1"
-STEP=0.1
-STATE="${XDG_RUNTIME_DIR:-/tmp}/xrandr-redshift"
+STATE="${XDG_RUNTIME_DIR}/gammastep-temp"
+STEP=500
+MIN=1000
+MAX=6500
-if [[ -f "$STATE" ]]; then
- GAMMA=$(cat "$STATE")
-else
- GAMMA=1.0
-fi
+current=$(cat "$STATE" 2>/dev/null || echo 6500)
case "$1" in
- up)
- GAMMA=$(awk -v g="$GAMMA" -v s="$STEP" 'BEGIN {
- g -= s
- if (g < 0.1) g = 0.1
- printf "%.1f", g
- }')
- ;;
down)
- GAMMA=$(awk -v g="$GAMMA" -v s="$STEP" 'BEGIN {
- g += s
- if (g > 1.0) g = 1.0
- printf "%.1f", g
- }')
+ current=$((current + STEP))
+ ;;
+ up)
+ current=$((current - STEP))
;;
esac
-echo "$GAMMA" > "$STATE"
-xrandr --output "$OUTPUT" --gamma "1.0:${GAMMA}:${GAMMA}"
+current=$(( current < MIN ? MIN : current > MAX ? MAX : current ))
+
+echo "$current" > "$STATE"
+gammastep -m randr -x
+gammastep -m randr -O "$current"