sxmo_brightness.sh: write brightness val directly to sysfs
This removes the dependency on an external compiled app for writing the brightness value to sysfs, and just echoes it directly to the backlight sysfs node. In addition, if the write fails, the script exits instead of sending a misleading notification. Signed-off-by: Stacy Harper <contact@stacyharper.net>
This commit is contained in:
parent
4c3e6044ce
commit
921ab1773a
1 changed files with 3 additions and 1 deletions
|
@ -17,12 +17,14 @@ MINSTEP=1
|
|||
STEP=$(echo "($MAX - $MIN) / 10" | bc | xargs -ISTP echo -e "$MINSTEP\nSTP" | sort -r | head -n1)
|
||||
|
||||
setdelta() {
|
||||
sxmo_setpinebacklight "$(
|
||||
VAL="$(
|
||||
xargs -IB echo B "$1" < $BACKLIGHT/brightness |
|
||||
bc |
|
||||
xargs -INUM echo -e "$MIN\nNUM" | sort -n | tail -n1 |
|
||||
xargs -INUM echo -e "$MAX\nNUM" | sort -n | head -n1
|
||||
)"
|
||||
echo "$VAL" > "$BACKLIGHT/brightness" || exit 1
|
||||
echo "set brightness to $VAL"
|
||||
|
||||
dunstify -i 0 -u normal -r 999 "☀ $(cat $BACKLIGHT/brightness)/${MAX}"
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue