misc/scripts/redshift-acpi

31 lines
471 B
Plaintext
Raw Normal View History

2019-01-26 18:51:26 +01:00
#!/bin/sh
# Set brightness for laptops backlight
PATH="$HOME/.local/bin:$PATH"
# brightness values
night=1000
transition=1500
daytime=2000
deref() {
eval "echo \$$1"
}
fade_to() {
current=$(brightness)
echo $current $1
step=10
[ "$current" -gt "$1" ] && sign=- || sign=+
for i in $(seq "$current" "${sign}$step" "$1"); do
brightness "$sign" "$step" > /dev/null
sleep 1
done
}
if [ "$1" = "period-changed" ]; then
fade_to "$(deref "$3")"
fi