27

Is there a way to adjust lighting step ? I have Lenovo L520, and Fn + Light Up or Down adjusts by 20%, how can I adjust the step to 10% ? it will help me fine tune lighting at my dark room.

Lekensteyn
  • 174,277

17 Answers17

18

Install xbacklight by opening a terminal with Ctrl+Alt+T shortcut and type this:

sudo apt-get install xbacklight

then after installation, type these commands in terminal:

xbacklight = 10
xbacklight = 20
xbacklight = 5

this may help.

Anwar
  • 76,649
boss
  • 196
  • 1
    This method worked perfect for me! Other way is: xbacklight -dec 1, or xbacklight -inc 1 (to increase or decrease 1%) – lepe Dec 13 '12 at 13:06
  • On a Asus n55s xbacklight accepts any value (even with decimal places), but actual values (as visible by try and see, and as returned by xbacklight without argument) are rounded down to the nearest 10%. – Stéphane Gourichon Jun 03 '14 at 20:09
  • It should be noted the man page recommends -set instead of =. More importantly, anyone mapping keys to this should really add -time 0 -steps 1 - because otherwise, xbacklight applies backlight fading by default, which seems to really wind up your (at least my) CPU when 'scrolling' brightness by holding down the assigned hotkey. I'm talking all cores rising from 45 to 60 degrees, over just a few seconds - best avoided. To be fair, I'm using 1% increments - where fading is even more pointless than normal - but still, don't tax your CPU if you don't have to. – underscore_d Oct 18 '15 at 23:06
  • xbacklight doesn't work on asus x8ain – Xetra Apr 25 '18 at 06:36
  • Lenovo Thinkpad T480s qith Xubuntu 18.04 gives No outputs have backlight property. – kiltek Jul 07 '19 at 08:25
10

There is a file in Ubuntu which stores numerical integer value of brightness. you will find 3 files in the directory /sys/class/backlight/<VGA>directory replace directory with intel_backlight for intel cards.

You will find the max brightness value in max_brightness file and according to that value set the brightness in brightness file.

yask
  • 672
  • 1
    This was shows if your hardware is capable for fine granularity or not. – V-Mark Jan 14 '16 at 09:15
  • using gedit, I notice 937 in the max_brightness file. What should I do? Decease it with a random number? @yask – Pranav Apr 15 '19 at 09:35
8

For Xubuntu LTS

Firstly, install xbacklight

$ sudo apt install xbacklight

Secondly, check whether you have control over the backlight.

$ xbacklight -1
$ xbacklight +5

Should these commands result in a No outputs have backlight property error, then follow these remediating steps before proceeding.

Once xbacklight -1 and xbacklight +1 work from the command line, proceed with assigning these commands to respectively the XF86MonBrightnessDown and XF86MonBrightnessUp keys. This is done by hitting those keys when asked by the Settings → Keyboard → Application Shortcuts application.

Finally, reboot for these changes to take effect.

Keyboard settings

Serge Stroobandt
  • 5,268
  • 1
  • 48
  • 59
4

You can install xcalib and then type the command:

xcalib -co 50 -a

Use xcalib -h for help regarding it's options.

ignite
  • 8,936
  • works on my macbook retina 15. Thanks! :-p – Pol Hallen Nov 02 '16 at 11:24
  • 2
    This works by sending darker images to your graphics card instead of adjusting the backlight. While it may seem to produce the desired effect, this is wasting energy and reduces the number of available colors. – Sunday Aug 17 '17 at 13:28
  • @Sunday But we use it to protect our eyes, not the battery – Xetra Apr 25 '18 at 06:33
  • I would not say that accidently reducing your color depth and thus introducing banding artifacts is very good for your eyes either... – Sunday Apr 27 '18 at 18:44
3

On Ubuntu 16.04, with Intel onchip graphics (i5) under LXQt, it is sufficient to assign xbacklight commands to the brightness function keys XF86MonBrightness(Down|Up) using the global key shortcut settings. These seem to override the defaults even if /sys/module/video/parameters/brightness_switch_enabled is set to Y, while the original functionality on virtual terminals is retained. LXQt global key shortcut configuration with xbacklight commands

An alternative to the original xbacklight would be acpilight, but unfortunately this isn't available as Ubuntu package. As it doesn't depend on an X display running, you can also associate it with ACPI button events and use it from the console. Additionally it can store the current brightness on shutdown and restore it on boot.

Murphy
  • 1,677
3

As Colin Ian King said, the levels of brightness are hardware related.

Some laptop screens have 8 levels of brightness and new ones have 16 levels.

On Windows OSes you can change the levels with 1% steps, but they will be rounded to the nearest hardware level. It depends on the screen type.

2

For me xbacklight did not work (EDIT: probably because I did not reboot my machine), therefore I created my own script which uses the built-in gsd-backlight-helper.

This script uses smaller steps, especially when the screen is quite dark already.

Step 0: check if it works (optional)

To see if it works you could try:

pkexec /usr/lib/gnome-settings-daemon/gsd-backlight-helper --get-brightness

This should output a number.

Step 1: save script

Save the following script in an .sh file, for instance in /home/me/scripts/brightness.sh.

#!/bin/bash

max=$(pkexec /usr/lib/gnome-settings-daemon/gsd-backlight-helper --get-max-brightness)
cur=$(pkexec /usr/lib/gnome-settings-daemon/gsd-backlight-helper --get-brightness)
if [ $(($max/$cur)) -ge 25 ]
then
    step=$((max/300+1))
else if [ $(($max/$cur)) -ge 5 ]
    then
        step=$((max/50+1))
    else
        step=$((max/20+1))
    fi
fi
case "$1"
in
+) new=$((cur+step));;
-) new=$((cur-step));;
esac
pkexec /usr/lib/gnome-settings-daemon/gsd-backlight-helper --set-brightness $new

Step 2: assign shortcuts

Open Keyboard Shortcuts from the Settings menu and assign shortcuts:

name:     Darker
command:  sh /home/me/scripts/brightness.sh -
shortcut: Super + F5

name:     Brighter
command:  sh /home/me/scripts/brightness.sh +
shortcut: Super + F6
Dirk
  • 21
  • what you mean ? xbacklight did not work ? when xbacklight is installed fresh, then you should reboot your machine. True, here was not said that, to reboot the machine. – dschinn1001 Oct 02 '18 at 01:15
  • Thanks. Indeed, I think I did not reboot my machine... Yet my script has the advantage that it uses smaller steps on darker screens and larger steps if the screen is quite bright already. – Dirk Oct 03 '18 at 05:01
2

My solution was to install 'xbacklight'

Then I created keyboard shortcuts such as

  • ctrlshift+ with command xbacklight +5
  • ctrlshift- with command xbacklight -5

So when you use those shortcuts they call the related command however I could not replace the system inbuilt brightness buttons to use these commands You can use almost any keyboard shortcut button combination you like with xbacklight.

Zanna
  • 70,465
puchu
  • 21
1

Official documentation:

https://www.x.org/archive/X11R7.5/doc/man/man1/xbacklight.1.html

inc percent Increases brightness by the specified amount.

dec percent Decreases brightness by the specified amount.

Example:

xbacklight -inc 10%

xbacklight -dec 10%

Afify
  • 11
1

The brightness levels are generally under ACPI control with the levels defined in firmware. For example the ACPI control method _BCL "Query List of Brightness Control Levels Supported" informs the kernel how many brightness levels are supported. You can't realistically change this.

1

In my case (Lenovo T500) the problem is, that the brightness regulating key-press is applied twice - once by using the Xwindows, but also independently in the lower level, by kernel's graphic driver itself. So the brightness steps are twice as big as usual.

The working solution is to deny the low-level functionality, by adding this line to /etc/rc.local (just before the line with 'exit 0'):

echo -n 0 > /sys/module/video/parameters/brightness_switch_enabled

This way it will perfectly work in logged-in X session, unfortunately it will remove the key-press brightness regulation functionality in all other cases (console terminal, X login screen etc).

0

Brightness cannot controlled with large precision. I'm afraid that you're stuck with those brightness levels. To be sure, try controlling the brightness using these terminal commands.

Lekensteyn
  • 174,277
  • 1
    If I go to System Settings, I find an icon labeled 'Screen' If I click on that icon I get a scroll bar that can set the brightness in small percents, How can I get this screen icon to the top bar ( besides clock, or battery indicator ) ? – Samir Sabri Feb 11 '12 at 09:13
  • 1
    What about https://launchpad.net/indicator-brightness? I haven't tried it since I don't use Unity/GNOME. – Lekensteyn Feb 11 '12 at 10:17
  • Have a look at http://askubuntu.com/a/58022/6969 – Lekensteyn Feb 11 '12 at 21:08
  • 1
    It definetely can be controlled in smallest steps in many cases. Please have a look at http://askubuntu.com/a/205509/43165. – vines Oct 25 '12 at 00:30
  • @vines Have you seen the linked post in my answer? It describes the same sysfs interface. The precision depends on the hardware. ACPI brightness values are often not that large. And the other driver interfaces it is possible that those use steps internaly (e.g. 1-10 still give "step 1"). – Lekensteyn Oct 25 '12 at 09:39
  • @Lekensteyn All your points are absolutely valid. I'm just a bit more optimistic in saying that it can often be done, rather than it's completely impossible. :) – vines Oct 25 '12 at 21:49
  • I like how this answer just fatalistically says there's no greater control than 20% available, without any reference to the OP's hardware, then cites commands that for many people do allow much finer control. Handy! – underscore_d Oct 18 '15 at 23:16
0

You could try setting it manually. First you have to get the PCI-ID of the VGA device:

lspci

Then try this (in my case the PCI-Device is 00:02.0)

sudo setpci -s 00:02.0 f4.b=FF

The 2 letters at the end of the Line set the new brightness ranging from 00-FF (0-255)

0

If you're on KDE, you can simply hover your cursor over the "Battery and Brightness" menu from your system tray and try to slowly scroll upwards or downwards to increment or decrement the brightness.

enter image description here

Olimjon
  • 7,292
0

On modern Gnome environment you can achieve fine-control effect with mouse scroll:

If you have smooth-scroll touchpad, position mouse pointer over brightness slider from top-right menu and perform fine two-finger scroll to adjust brightness with tiniest steps.

enter image description here

grandrew
  • 111
0

If you are using Nvidia Graphic card..you can easily use my new method of brightness changing,and edit values in Code.. theres two files and two options within each one.

find these two lines:

if ( $value > 0.0) { $value = $value - 0.30 };  
if ( $value2 > 1.1) { $value2 = $value2 - 0.08 }; 

change values of ($value > 0.0) & ( $value2 > 1.1) and see whats happens!

meanwhile if you dont want to change values and wish to use my method originally you can change brightness in a wide range and 5 steps. wish you like it

link of method: https://askubuntu.com/a/179063/82136

  • Uh... isn't this just mangling the bitmap before it's sent to the screen, rather than actually changing the screen's brightness? – underscore_d Oct 18 '15 at 23:14
-4

Hold down Ctrl while increasing/decreasing the brightness. Increases in steps of 1.

David Foerster
  • 36,264
  • 56
  • 94
  • 147