0

I have a laptop with Manjaro XFCE and I damaged my F2 and F3 keys, which operate the brightness of the display (up and down respectively) while holding the Fn key.

The xfce-power-manager works fine, and I can use the slider on the bottom bar, but I would like to know if I can remap brightness to other keys. I haven't been able to find a solution for now.

I tried instaling light package, as I saw in another reply, and using:

light -U 20

decreases the brightness as expected, but it has to be done as root, so my idea to remap that command to another key combination, doesn't work, because it doesn't have privileges.

Any idea? Thanks!

8
  • wiki.archlinux.org/title/backlight#xbacklight maybe? You could add shortcuts for xbacklight -inc 5 and xbacklight -dec 5 Aug 31 '21 at 13:21
  • @ArtemS.Tashkinov I tried that, but I got the "No outputs have backlight property" that the wiki talks about. But I don't have a /etc/X11/xorg.conf.d/20-video.conf, and creating it with the suggested content doesn't change the output (same "no outputs have backlight property" error)
    – PolGZ
    Aug 31 '21 at 14:13
  • Please report here gitlab.freedesktop.org/drm/intel/-/issues Aug 31 '21 at 14:57
  • As commented here, using acpilight package instead of xorg-backlight package in Arch made the commands xbacklight -inc 10 (and the decrease option) work. But again as with light package, I need sudo. I havn't been able to edit sudoers in a way that my user can run (just) that script without sudo. But that is another problem. If nobody has another idea, I will explore how to run a script like that.
    – PolGZ
    Sep 1 '21 at 16:21
  • I rolled back your recent edit tagging the title with "SOLVED". If you have a solution then consider adding that solution as a separate answer and accept it later (don't add it into the question). Accepting an answer will mark the question as resolved. Please see unix.stackexchange.com/help/self-answer You should be able to simply copy the text from your most recent revision of the question text and make a separate answer from that.
    – Kusalananda
    Sep 1 '21 at 18:06
0

Finally I got to a solution. Here is what I did (better ways would be welcome!)

  1. Instead of xorg-xbacklight package as showed in the Arch Wiki as default option (because I got the error "no outputs have backlight property" that the wiki talks about, and using the .conf parameters showed in the wiki didn't solve it for me) I installed: acpilight package. It runs the same way as xorg-xbacklight:

    • xbacklight -inc 10 to increase, and
    • xbacklight -dec 10 to decrease. As suggested by @ArtemS.Tashkinov here in the comments.
  2. To control xbacklight and chenge backlight level, you need sudo privileges, so I needed to edit sudoers to make my user able to run the xbacklight command without asking for the password (but, for security reasons, of course, only that, and not any command):

    1. sudo visudo (vim like editor) or su and then visudo (with your default editor, in case your are used to nano)
    2. Add the following (changing username for your user):
      username ALL=(ALL) NOPASSWD: /usr/bin/xbacklight
      
  3. To avoid the possible error (I had it) /usr/bin/xbacklight: [Errno 13] Permission denied: '/sys/class/backlight/intel_backlight/brightness'; I added my user to the video group, which is the default in 90-backlight.rules (as I saw here) (change username for your user name):

    sudo usermod –a –G video username
    
  4. Create two scripts called bright-up.sh and bright-down.sh (or whatever you want), with this content:

    #! /bin/bash
    
    xbacklight -inc 10
    
    • Change -inc for -dec in the bright-down.sh
    • Change 10 for the value you want, like 5 or 20, depending on how much you want the brightness to change.
  5. Place those scripts in a directory like /home/user/.bin/ or wherever you want and give them execute permissions:

    chmod +x /home/user/.bin/brigh-up.sh /home/user/.bin/bright-down.sh
    
  6. Now create keyboard shortcuts pointing to those scripts according to your desktop environment/window manager. In XFCE in keyboard > keyboard shortcuts.

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.