intel_backlight script(s)?

Has anyone written scripts for intel_backlight?

for adjusting to battery level, AC power state, remembering brightness across sessions etc..

I looked and i do not have a isl device so no light sensor for
 
accessibility/redshift adjusts the color temperature of your screen depending on the local time. acpi_video(4) offers you three brightness levels depending on whether you are on AC power or not. To remember the brightness after reboots, I added entries to /etc/sysctl.conf. Then, there are hotkeys for changing the brightness levels.

Not sure if a script is needed. ;D
 
accessibility/redshift adjusts the color temperature of your screen depending on the local time. acpi_video(4) offers you three brightness levels depending on whether you are on AC power or not. To remember the brightness after reboots, I added entries to /etc/sysctl.conf. Then, there are hotkeys for changing the brightness levels.

Not sure if a script is needed. ;D

the X86freedesktop bindings for brightness do not work for me, nor does adjusting the values that acpi_video or acpi_hp provides.
The keys do nothing for me, what does work is the intel_backlight command.. which is why I made this post.
intel_backlight does not persist across reboots or resuming
which is why i want to make a script for it. so i can manualy assign binds for it and have it persist
 
Has anyone written scripts for intel_backlight?

for adjusting to battery level, AC power state, remembering brightness across sessions etc..

I looked and i do not have a isl device so no light sensor for
I have one, the only problem that I could not solve was/is when the display is coming back from "screensaver" mode is not keeping the current value and it goes to 100%, but with a keybind I'm back to default setled value.
!!! Also keep in mind that this script was made to work with a Lenovo Thinkpad T430/T530/W530 and i3blocks.

Bash:
#!/bin/sh
# intel backlight controled with mouse click, power line and battery state.

IBI=intel_backlight
IBA=$(intel_backlight  | tail -n 1 | cut -c26-29 | tr -d ':%' | sed 's/[a-zA-Z]//g')
BState=$(sysctl hw.acpi.battery.state | cut -d " " -f2)                                     # 2)-Battery is charging; 1)-Battery is discharging; 0)-High state (no charging or discharging).
ACLine=$( sysctl hw.acpi.acline | cut -d " " -f2)                                           # 1)-Power in pluged; 0)-Power is unplugged


case $BLOCK_BUTTON in                                                                       # This function works only when the battery is in high statex (0).
    1) $IBI incr 5 > /dev/null 2>&1 ;;                                                      # Left click increase backlight with 5%.
    2) $IBI 70 > /dev/null 2>&1 ;;                                                          # Middle click set backlight to a specified value.
    3) $IBI decr 5 > /dev/null 2>&1 ;;                                                      # Right click decrease backligh with 5%.
esac

if [ "${ACLine}" -eq 0 ]; then
    case $BState in
        0) if [ "${IBA}" -ge 16 -a "${IBA}" -le 99 ]; then
                echo "${IBA}%"
                echo " "
            fi
        ;;
        1)  if [ "${IBA}" -ge 16 -a "${IBA}" -le 100 ]; then
                $IBI 40 > /dev/null 2>&1
                echo "${IBA}%"
                echo " "
            fi
        ;;
    esac
 elif [ "${ACLine}" -eq 1 ]; then
       case $BState in
           2) if [ "${IBA}" -gt 16 -a "${IBA}" -le 100 ]; then
                $IBI 70 > /dev/null 2>&1
                echo "${IBA}%"
                echo " "
              fi
        ;;
          0) if [ "${IBA}" -ge 16 -a "${IBA}" -le 100 ]; then
                 echo "${IBA}%"
                echo " "
             fi
              ;;
       esac
fi
 
I have one, the only problem that I could not solve was/is when the display is coming back from "screensaver" mode is not keeping the current value and it goes to 100%, but with a keybind I'm back to default setled value.
!!! Also keep in mind that this script was made to work with a Lenovo Thinkpad T430/T530/W530 and i3blocks.
I was running into that same issue. I was hoping to resolve it without resorting to something juvenile and janky,
Which would be saving the value it was set to and doing periodic checks to change it.
This might be easier in python which is what I am going to try

Thanks for the script
 
I think devd sees power related events. You can add a devd rule to run intel_backlight at a reduced setting once battery capacity falls below some threshold.
 
Unless you rewrite the whole program to remember those settings between sessions it doesn't matter if the script is written in sh, python, perl, etc. The "juvenile and janky" part can be avoided by using cron.
 
Unfortunately the various acpi_ibm(4), acpi_hp(4) etc. are either very outdated (at least acpi_ibm) or get obsoleted by new models frequently... nearly every new model introduces some change in the keycodes it sends :( thus no catch-all scripts exist.
 
Back
Top