diff --git a/sbin/99-intelbacklighthack.rules b/sbin/99-intelbacklighthack.rules new file mode 100644 index 0000000..bb11ff0 --- /dev/null +++ b/sbin/99-intelbacklighthack.rules @@ -0,0 +1 @@ +ACTION=="change", SUBSYSTEM=="backlight", RUN+="/usr/local/sbin/backlighthack.sh" diff --git a/sbin/backlighthack.sh b/sbin/backlighthack.sh new file mode 100755 index 0000000..f23adf0 --- /dev/null +++ b/sbin/backlighthack.sh @@ -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