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
For waking up from suspension, I create the following script /etc/pm/sleep.d/brightness
:
#!/bin/sh
case "$1" in
resume|thaw)
echo 170 > /sys/class/backlight/intel_backlight/brightness
;;
esac
And the permission of the script is -rwxr-xr-x
. This should also solve your problem.
But if the screen is dimmed, the brightness is set to maximum after recovering from the dimming.
This is really a bug which should be fixed.
I am using ubuntu 64 bit 14.04 with a Thinkpad T440s.
Best Answer
Run this to see a list of your outputs. You're looking for the one that is "connected":
Here's a screenshot of my list. The output I want is the "connected"
eDP1
at the top:Now you can run these commands to make adjustments. Replace
eDP1
with the name of your output, and change1.2
to make the adjustments:You can also use
gamma
instead ofbrightness
: