Ubuntu – How to make the screen brightness not change when I plug the laptop in

brightnesslaptoppower-managementscreen

I do not want my laptop to change brightness when my laptop power is plugged in or unplugged. I set my brightness based on how bright my surroundings are. If I am in a dark room, I set my brightness very low and when I plug my laptop in the brightness gets set to maximum which feels like sticking my eyes in boiling lava.

In System SettingsBrightness and Lock the Dim screen to save power checkbox is unchecked.

My laptop is an HP Mini 110

In case it is an acpi issue I have put my acpi-support file here
[link removed because it expired]

Best Answer

  • I tested a solution that works fine for me. One solution is to add a script file in /etc/pm/power.d/

    Just creates a file

    sudo vi /etc/pm/power.d/run_after_pwrmanagmt.sh
    

    Then writes this code into this file :

    case "${1}" in
        true) #battery_mode
            xinput set-int-prop 12 277 8 2 3 0 0 1 3 2
            echo 4000 > /sys/class/backlight/intel_backlight/brightness
    ;;
        false) #ac_mode
            xinput set-int-prop 12 277 8 2 3 0 0 1 3 2
            echo 4000 > /sys/class/backlight/intel_backlight/brightness
    esac
    

    Now, you need to give execution rights to this file by typing

    sudo chmod +x /etc/pm/power.d/run_after_pwrmanagmt.sh
    

    Now it should work fine, just test to plug/unplug your computer. Note that you can do similar things after a suspend (/etc/pm/sleep.d/run_after_sleep.sh), that's how I found out this solution... You will find information on the web...

    Note that xinput is just a command for my trackpad to set the middle button working... You should skip the two lines xinput if not needed (or adapt ). For the value 4000, it may be diffrent for each screen, you should first see what is your max value with the command cat /sys/class/backlight/intel_backlight/max_brightness

    Hope this helps, and that the moderator will not delete this post since this is an answer and not a question. Thanks