Files
dotfile/script/dim_lum.sh
T
2024-09-14 19:16:24 +02:00

23 lines
556 B
Bash

#!/bin/sh
#augmente la luminosité de arg%, 10% si non spécifié
#retourne le % de luminosité en fin de commande
max=$(cat /sys/class/backlight/apple-panel-bl/subsystem/apple-panel-bl/max_brightness)
if [ -n "$1" ]
then
dim=$1
else
dim=10
fi
next=$(expr $(cat /sys/class/backlight/apple-panel-bl/subsystem/apple-panel-bl/brightness) - $max '*' "$dim" '/' 100)
if [ -z "$next" ]
then
exit 1
fi
if [ $next -lt 0 ]
then
next=0
fi
echo $next > /sys/class/backlight/apple-panel-bl/subsystem/apple-panel-bl/brightness
echo $(expr $next "*" 100 "/" $max)