Results 1 to 2 of 2

Thread: A Guide to get Screen Brightness adjustments to work in LXDE

  1. #1

    Default A Guide to get Screen Brightness adjustments to work in LXDE

    Hi All,

    I don't know if many people use LXDE but I happen to use it on a netbook with 2gB RAM and it works brilliantly. I had to get a few things sorted out after install. These were things like automatically showing the last user name at the login prompt, setting DNS on the WIFI etc. The most annoying one was, LXDE did not have a screen brightness adjustment option nor did the hot keys for it work. To add to my frustration, xbacklight couldn't fix it either. After a lot of research, I found a way to allow screen brightness adjustments:

    1. The screen brightness is controlled via a number in the file: "/sys/class/backlight/<folder name, e.g. intel_backlight/brightness". But the default permissions won't allow to write to it without sudo. This means even if you set a keyboard shortcut to set this number, it won't work.
    2. To add write + execution permission, I did
      Code:
      sudo chmod -c -v a+x+w /sys/class/backlight/intel_backlight/brightness
      . Note: the -c-v flag is to show verbose.
    3. The next step was to formulate a bash script which I could assign to my brightness control keys. I wanted an elegant solution, I.e. not having two bash script files (one for increasing brightness, decreasing etc.) that needs to be called all the time. This is how I achieved it.
    4. First set up a hotkey for increasing the brightness (choose any combination) in the lxhotkey window as an execute-command option. Then add this command
      Code:
      bash -c "while read name; do  bash \-c \"echo \$((name+100)) >  /sys/class/backlight/intel_backlight/brightness\";done <  \"/sys/class/backlight/intel_backlight/brightness\""
      . Note your folder may differ from intel_backlight and depending on your laptop, your brightness might run from 0-8 but mine goes from 0-2400, hence I increase the brightness at a step of 100 (see $name+100). You need to chose your preference here.
    5. Similarily, repeat step 4 but this time choose your decrease brightness keys and add the same script with the following change:
      Code:
      $((name-100))

    I think this makes sense, it took me a while to figure this out and the internet eventually proved helpful so I hope this helps you save time/frustration.

    Reference:
    1.https://robertgrantstats.wordpress.c...in-lxde-linux/
    2.https://stackoverflow.com/questions/...-to-a-variable
    3.https://help.ubuntu.com/community/FilePermissions

  2. #2
    Join Date
    Jun 2008
    Location
    Auckland, NZ
    Posts
    20,284
    Blog Entries
    1

    Default Re: A Guide to get Screen Brightness adjustments to work in LXDE

    As this is a "how to" rather than a request for help, I'll move it to the 'Unreviewed How To and FAQ' sub-forum.
    openSUSE Leap 15.0; KDE Plasma 5

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •