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.

35 lines
829 B

5 years ago
#!/usr/bin/env sh
# include common definitions
# shellcheck source=scripts/core/sxmo_common.sh
. "$(dirname "$0")/sxmo_common.sh"
[ -e /sys/class/backlight/edp-backlight ] && DEV=/sys/class/backlight/edp-backlight
[ -e /sys/devices/platform/backlight/backlight/backlight ] && DEV=/sys/devices/platform/backlight/backlight/backlight
MAX=$(cat $DEV/max_brightness)
5 years ago
MIN=2
MINSTEP=1
STEP=$(echo "($MAX - $MIN) / 10" | bc | xargs -ISTP echo -e "$MINSTEP\nSTP" | sort -r | head -n1)
5 years ago
setdelta() {
sxmo_setpinebacklight "$(
xargs -IB echo B "$1" < $DEV/brightness |
bc |
xargs -INUM echo -e "$MIN\nNUM" | sort -n | tail -n1 |
xargs -INUM echo -e "$MAX\nNUM" | sort -n | head -n1
)"
dunstify -i 0 -u normal -r 999 "$(cat $DEV/brightness)/${MAX}"
5 years ago
}
up() {
setdelta "+${STEP}"
5 years ago
}
down() {
setdelta "-${STEP}"
5 years ago
}
"$@"