6

I freshly installed Lubuntu 18.10 with LXQT environment and here's my issue : I want to dim the backlight of my laptop with the keyboard shortcut (XF86) but when i press it, it changes the brightness(which seems to be a software change because it messes with gamma and contrast)

So i went to the keyboard shortcuts bindings to find the menu that changes what i want :

lxqt-config-brightness menu

^ the slider controls backlight (usual brightness) and the knob messes with contrast..

Here is the shortcut config menu :

lxqt shortcuts

However, there is no way i can find to inc or dec the slider instead of the knob, to have control over backlight. xbacklight and xrandr doesn't work as they output "no output with backlight property" but i can change backlight with echo 700 | sudo tee /sys/class/backlight/intel_backlignt/brightness which sets backlight to 700, but i don't know how to implement inc or dec on a shortcut with this :c

Teach me some unix please :)

4
  • I guess all this is rather buggy. My shortcuts work as I expect them to, but changes made with the shortcuts are not reflected in the brightness settings, as both the slider and the knob seem unaffected by the shortcut actions. It is as if separate tools overlap here. – user47206 Nov 19 '18 at 10:52
  • Well my shortcut button affects the knob indeed, but not the slider.. – ReSpir3 Nov 20 '18 at 19:53
  • I booted Lubuntu 18.10 on a thumb-drive (I only have it installed on a desktop), and like clpricus, the shortcut keys on my lenovo sl510 only dimmed the brightness (moving only slider, having no impact on 'knob' setting). – guiverc Nov 21 '18 at 5:12
  • I have an acer aspire one cloudbook AO1-431-C89V (ref doesn't matter xD) and is 3 years old, booting lubuntu from ram before installing had the same issue :c – ReSpir3 Nov 30 '18 at 22:38
3

The simplest way I have discovered that doesn't require sudo is to use pkexec lxqt-backlight_backend --inc to increase the backlight brightness and pkexec lxqt-backlight_backend --dec to decrease it.

You can add keyboard shortcuts for these commands in LXQt. I hope this will be fixed soon and it will become the default action for brightness adjustement keyboard combinations instead of the rather useless contrast regulation.

3
  • This works great for me. Shortcuts for the brightness keys were set to lxqt-config-brightness -d by default which wasn't working properly for me when Redshift was active (they actually worked fine by default if I fully disabled it). Regardless, this change gave me back hardware key backlight control so thanks for this. – colorful-shirts Feb 3 at 14:13
  • Spoke too soon. While the commands work in the terminal, somehow adding them to the shortcut key list does not. I'm stumped as to why. – colorful-shirts Feb 3 at 14:20
  • i'm back two years later with the same pc and lubuntu 20.04, and yes it only works in the terminal somehow... i also installed lubuntu on an old dell pc and followed instructions below with xbacklight and it worked fine. i'm going to try them on my acer pc. – ReSpir3 Feb 4 at 15:27
1

You can add the command lxqt-backlight_backend --dec to the 'shortcut config menu' to decrease the brightness and the command lxqt-backlight_backend --inc to increase it.

However, the commands need root permissions to run. One way to overcome this is to manually change the permissions of /sys/class/backlight/intel_backlight/brightness, but the change isn't permanent, since it will be reset after reboot. If I find a way to make the change permanent I will post it here.

1
  • oh wow thanks ! this command is much more elegant, i wonder why it required root, where did you find this command exists ? I would like to know if there are more things that i can shortcut – ReSpir3 Nov 30 '18 at 22:50
1

I had the same issue for a very long time, but I finally solved it! I was searching for a solution when I found this: https://help.ubuntu.com/community/Lubuntu/Keyboard#Keyboard_shortcuts . And it says:

Control+F10

Laptop screen dim

Control+F11

Laptop screen brighten

I was curious about this shortcut key, because I used a different one to change my brightness. And as soon as I tried, an error popped up saying that xbacklight could not be found. This leaded me to the solution of our problem:

First, I installed xbacklight with the command sudo apt-get install xbacklight. Only this should've worked for me, but my xbacklight was always returning the following error when executed through the terminal:

No outputs have backlight property

So I googled it and found a solution: https://askubuntu.com/a/1060843 This answer solved the error for me. With xbacklight working, I just created shortcut keys for the following commands:

To increase brightness (-time 0 is optional, just for it to change instantly):

xbacklight -inc 10 -time 0

To decrease brightness (-time 0 is optional, just for it to change instantly):

xbacklight -dec 10 -time 0

This is incredibly practical as it doesn't require root to work, so it will work as soon as you add these shortcuts and will last forever (no sudo after reboot for it to work again :D ).

To summarize:

  1. Install the xbacklight package with:

    sudo apt-get install xbacklight
    
  2. Add the following command to your favourite shortcut keys to increase brightness:

    xbacklight -inc 10 -time 0
    
  3. Add the following command to your favourite shortcut keys to decrease brightness:

    xbacklight -dec 10 -time 0
    
  4. If the commands don't work, this might be the solution: https://askubuntu.com/a/1060843

References:

1
  • definitely works but xbacklight has the drawback to be able to shut brightness to 0 and doesn't change backlight independently of brightness, you like it or not. also the fix for the "no outputs have backlight propriety" requires sudo to be able to create a file in X11. sudo touch to create the file then sudo chmod to be able to write something inside, that's how i figured it out, but there may be a cleaner way to do so, as proposed below or above – ReSpir3 Feb 4 at 18:52
1

I had the same issue in Lubuntu 20.04. Solution:

  1. In terminal run: lxqt-config-globalkeyshortcuts and change:
    lxqt-config-brightness -d => lxqt-backlight_backend --dec
    lxqt-config-brightness -i => lxqt-backlight_backend --inc
  2. In terminal run: sudo chmod u+s /usr/bin/lxqt-backlight_backend to resolve root permission problem.
2
  • probably the cleanest solution, gives better results than xbacklight. xbacklight changes backlight and gamma at the same time – ReSpir3 Feb 4 at 17:34
  • and survives reboot ! bravo ! – ReSpir3 Feb 4 at 18:53
0

Using what you had already discovered worked, I tried on a Lubuntu 18.10 (live) system

echo `cat /sys/class/backlight/intel_backlight/brightness` +180000|bc |sudo tee /sys/class/backlight/intel_backlight/brightness

which would increase my brightness

and

echo `cat /sys/class/backlight/intel_backlight/brightness` -80000|bc |sudo tee /sys/class/backlight/intel_backlight/brightness

which likewise reduced my brightness.

I recommend you work out whatever value you're happy with, and use that (and probably the same for both unlike my testing).

You can then use the 'shortcut config menu' you've already found to create a keyboard shortcut you're happy with for both commands. I didn't try and replace my existing keys, just used a new keystroke that I could live with.

6
  • ps: this involves no error checking, eventually you'll get negative values if you keep trying to reduce the brightness, or values beyond what your screen can handle. I didn't test the effects of this (nor would my lenovo possibly respond the same as your hardware) – guiverc Nov 21 '18 at 6:08
  • oh wow you nailed it ! I just tested the effects of this and it does not go below 300, just returns "invalid argument". but it required password when i tried it on qterminal – ReSpir3 Nov 30 '18 at 22:48
  • Yeah (re: password) I used sudo so it does require elevated permissions (unless already elevated due to use in prior 5 mins or whatever your threshold is). This wasn't a problem with me as i tested using 'live' and thus didn't notice it as a problem, and I'd not suggest using NOPASSWD.... – guiverc Dec 1 '18 at 2:23
  • I removed the sudo from my command, but also ran sudo chmod a+rw /sys/class/backlight/intel_backlight/brightness that gets written to (in my answer). This worked for me on my tested older version, but alas did not survive reboot. To get around that, I added the chmod a+rw /sys/.. command to a login script (I used ~/.profile) so it gets run on login... It's a hack, and I didn't test on 18.10, but worked on a eeepc that was handy.. – guiverc Dec 1 '18 at 2:35
  • ps: it's I hope obvious; but the command I added to my .profile was chmod a+rw /sys/class/backlight/intel_backlight/brightness (not an abbreviated version I typed before). Also I'd suggest checking for typos, thjs is typed into a 19.04 desktop & not the eeepc I tested with.. – guiverc Dec 1 '18 at 2:51
0

If you want to set the brightness to 50%, you can run:

lxqt-config-brightness -s 50

The -s option sets brightness from 1 to 100.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.