aboutsummaryrefslogtreecommitdiff
path: root/yoga/bin/night-light
diff options
context:
space:
mode:
Diffstat (limited to 'yoga/bin/night-light')
-rwxr-xr-xyoga/bin/night-light44
1 files changed, 0 insertions, 44 deletions
diff --git a/yoga/bin/night-light b/yoga/bin/night-light
deleted file mode 100755
index b76054d..0000000
--- a/yoga/bin/night-light
+++ /dev/null
@@ -1,44 +0,0 @@
-#!/bin/bash
-# Usage: night-light [increase|decrease|day|night]
-set -e
-
-TMPFILE=/tmp/.night-light-index
-
-# https://askubuntu.com/a/1061304
-STEPS=(
- "1:0.18172716:0.00000001"
- "1:0.42322816:0.00000001"
- "1:0.54360078:0.08679949"
- "1:0.64373109:0.28819679"
- "1:0.71976951:0.42860152"
- "1:0.77987699:0.54642268"
- "1:0.82854786:0.64816570"
- "1:0.86860704:0.73688797"
- "1:0.90198230:0.81465502"
- "1:0.93853986:0.88130458"
- "1:0.97107439:0.94305985"
- "1:1:1"
-)
-
-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)) ;;
- day) NEW=$((${#STEPS[@]}-1)) ;;
- night) NEW=0 ;;
- *)
- echo "Invalid argument '$1'"
- exit 1
- ;;
-esac
-
-echo $NEW > $TMPFILE
-
-for MONITOR in $(xrandr --listactivemonitors | tail -n +2 | cut -d'+' -f2 | cut -d' ' -f1 | sed 's/^\*//'); do
- BRIGHTNESS=$(xrandr --verbose | grep "^$MONITOR" -A5 | grep Brightness | cut -d':' -f2 | sed 's/\s*//')
- xrandr --output $MONITOR --gamma ${STEPS[$NEW]} --brightness $BRIGHTNESS || true
-done