Ubuntu – 15.10 Brightness adjustment

backlightbrightnesslaptopscreenthinkpad

I have a 2015 Thinkpad X1 Carbon that I just installed Ubuntu 15.10 on. I have noticed that there is a huge jump between the minimum screen brightness, where the backlight is completely off, to the next lowest. The second lowest seems to be much brighter than the lowest setting on Windows 10.

I use this computer a lot at night, and it would be really nice to have a very dim setting where the backlight is still on. Is there a way to change the brightness steps?

Best Answer

I used the top answer on this as basis for my own script for managing backlight brightness: Brightness Controls Not Working on a Dell Inspiron N4010 Laptop

Unlike OP ( user152748 ) there and similarly to you, backlight controls were basically working, but i just wanted the ability to fine tune it. This method will not affect how your normal backlight brightness adjustment works.

So what you need to know is if /sys/class/backlight/intel_backlight/brightness is the correct file for your system.

You could test it with sudo echo $VALUE | tee /sys/class/backlight/intel_backlight/brightness where $VALUE is a number you want to try. Your permitted values are probably different from mine (0 to ~4000). In the case of my Dell laptop, it just doesnt work if i try an incorrect value.

If this method works for you, then you just have to make a script and assign hotkeys to it. My modified version of bcbc's script is this one (at the lower end adjusts by increments of 1; the higher the brightness level, the bigger the increment):

#!/bin/bash
# Dell N4010 brightness control workaround
# Note: add the following to /etc/rc.local
#       chmod 777 /sys/class/backlight/intel_backlight/brightness
# The file .config/khotkeysrc should contain the hotkeys CTRL+SHIFT+F4/F5 to
# adjust brightness down and up respectively.
#
# Usage:
#    ./brightness.sh up   # bump up brightness
#    ./brightness.sh down # bump down brightness
#
curr=`cat /sys/class/backlight/intel_backlight/brightness`
bump=$(( $curr / 50 ))
if [ "$1" == "up" ]; then
  curr=`echo "$curr + $bump + 1" | bc`
else
  curr=`echo "$curr - $bump - 1" | bc`
fi
# Set the brightness to the new level. 0 is the lower limit. Cant set it lower than that.
echo $curr | tee /sys/class/backlight/intel_backlight/brightness
echo $bump

If you're interested i can walk you through the code step by step.

As the comments in the code indicate, you need to edit the file /etc/rc.local (which is run at a certain point in the boot process) to include this line chmod 777 /sys/class/backlight/intel_backlight/brightness (changes permissions of this brightness file to allow anything to it by anyone) before this line: exit 0 (because in rc.local all code must be before exit 0).

You also need to set up your hotkeys which can be done via GUI (The link at the top has instructions how to do that in Ubuntu or you can search the web for "how to set custom hotkeys ubuntu"). You have to choose some key combination for it (i prefer something close to the original brightness adjustment keys). The second half of setting up custom hotkeys is telling it what to do when said keys are pressed. You want 2 hotkeys, one running $path_to_your_file/your_file.sh up and the other one $path_to_your_file/your_file.sh down. Alternatively you can manually edit the file where hotkeys are stored on Ubuntu and its derivatives: $home/.config/khotkeysrc

Ill be happy to elaborate anything unclear.

Related Question