Auto Backlight and Sensor detection, Scale needs to be set manualy

This commit is contained in:
steel99xl 2024-01-03 18:45:44 -05:00
parent e6807f6dce
commit 21173c5eee

View file

@ -16,8 +16,6 @@ AnimationDelay=0.016
# Read the variable names # Read the variable names
MaxScreenBrightness=96000
MinimumBrightness=001 MinimumBrightness=001
@ -71,10 +69,15 @@ priority=19 # Priority level , 0 = regular app , 19 = very much background app
# Set the priority of the current script, Thank you Theluga. # Set the priority of the current script, Thank you Theluga.
renice "$priority" "$$" renice "$priority" "$$"
MaxScreenBrightness=$(find -L /sys/class/backlight -maxdepth 2 -name "max_brightness" 2>/dev/null | grep "max_brightness" | xargs cat)
BLightPath=$(find -L /sys/class/backlight -maxdepth 2 -name "brightness" 2>/dev/null | grep "brightness")
LSensorPath=$(find -L /sys/bus/iio/devices -maxdepth 2 -name "in_illuminance_raw" 2>/dev/null | grep "in_illuminance_raw")
OldLight=$(cat /sys/bus/iio/devices/iio\:device0/in_illuminance_raw) OldLight=$(cat $LSensorPath)
while true while true
do do
@ -87,7 +90,7 @@ do
$(chmod 666 /dev/shm/AB.offset) $(chmod 666 /dev/shm/AB.offset)
fi fi
Light=$(cat /sys/bus/iio/devices/iio\:device0/in_illuminance_raw) Light=$(cat $LSensorPath)
Light=$((Light + OffSet)) Light=$((Light + OffSet))
if [[ $Light -lt $LightChange ]] if [[ $Light -lt $LightChange ]]
@ -103,7 +106,7 @@ do
then then
CurrentBrightness=$(cat /sys/class/backlight/intel_backlight/brightness) CurrentBrightness=$(cat $BLightPath)
Light=$(( $Light + $MinimumBrightness )) Light=$(( $Light + $MinimumBrightness ))