You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
57 lines
1.4 KiB
57 lines
1.4 KiB
2 years ago
|
#!/usr/bin/bash
|
||
|
|
||
|
set -eu
|
||
|
|
||
|
exec >> ~/.redshift-hooks.log 2>&1
|
||
|
|
||
|
# path to github.com/qualiaa/acpi-brightness script
|
||
|
readonly brightness=$HOME/usr/bin/brightness
|
||
|
|
||
|
readonly fade_time=$(( 60*60 ))
|
||
|
readonly day_brightness=90
|
||
|
readonly transition_brightness=60
|
||
|
readonly night_brightness=5
|
||
|
|
||
|
|
||
|
brightness() {
|
||
|
local seconds=${1:-0}
|
||
|
local cond=${2:-}
|
||
|
"$brightness" -t $seconds $cond $percent
|
||
|
}
|
||
|
if [ $1 = "period-changed" ]; then
|
||
|
case $3 in
|
||
|
daytime)
|
||
|
percent=$day_brightness
|
||
|
case $2 in
|
||
|
transition)
|
||
|
brightness $fade_time --inc ;;
|
||
|
night|none)
|
||
|
brightness ;;
|
||
|
*)
|
||
|
echo "Unrecognised: $2"
|
||
|
esac ;;
|
||
|
transition)
|
||
|
percent=$transition_brightness
|
||
|
case $2 in
|
||
|
daytime)
|
||
|
brightness $fade_time --dec ;;
|
||
|
night)
|
||
|
brightness $fade_time --inc ;;
|
||
|
none)
|
||
|
brightness ;;
|
||
|
*)
|
||
|
echo "Unrecognised: $2"
|
||
|
esac ;;
|
||
|
night)
|
||
|
percent=$night_brightness
|
||
|
case $2 in
|
||
|
transition)
|
||
|
brightness $fade_time --dec ;;
|
||
|
daytime|none)
|
||
|
brightness ;;
|
||
|
*)
|
||
|
echo "Unrecognised: $2"
|
||
|
esac
|
||
|
esac
|
||
|
fi
|