Save hints about backlight hack on laptop

This commit is contained in:
Jan Philipp Timme 2019-03-25 16:02:50 +01:00
parent ee4ebf4b9b
commit c20416644b
2 changed files with 15 additions and 0 deletions

View File

@ -0,0 +1 @@
ACTION=="change", SUBSYSTEM=="backlight", RUN+="/usr/local/sbin/backlighthack.sh"

14
sbin/backlighthack.sh Executable file
View File

@ -0,0 +1,14 @@
#!/bin/bash
intelmaxbrightness=`cat /sys/class/backlight/intel_backlight/max_brightness`
acpimaxbrightness=`cat /sys/class/backlight/acpi_video0/max_brightness`
scale=`expr $intelmaxbrightness / $acpimaxbrightness`
acpibrightness=`cat /sys/class/backlight/acpi_video0/brightness`
newintelbrightness=`expr $acpibrightness \* $scale`
curintelbrightness=`cat /sys/class/backlight/intel_backlight/actual_brightness`
if [ "$newintelbrightness" -ne "$curintelbrightness" ]; then
echo $newintelbrightness > /sys/class/backlight/intel_backlight/brightness
fi
exit 0