How To Adjust Monitor Brightness From Command Line In Linux

12 Responses

  1. 01101001b says:

    This is EXACTLY what I was searching for. Thank you so much!

  2. kumar says:

    It works. Thank you.

  3. Sturge says:

    There’s a simpler way: xgamma -gamma 1.0
    1.0 is the default value. Use 2.0 to double the brightness, 0.5 to halve it, etc.

  4. Agathe says:

    try xbacklight

  5. Stef says:

    As far as I know, gamma and brightness are two different things. See here for a detailed comparison https://graphicdesign.stackexchange.com/questions/11445/gamma-vs-brightness-any-difference. Conceptually, the gamma is more like the ‘contrast’ than that ‘brigthness’. That does not mean that xgamma is useless but using it to control the brightness of the screen is probably a bad idea.

  6. Stef says:

    The problem with xrand is that it probably does not work when using a Wayland based desktop. This is because xrandr relies on X11 protocols that are only supported read-only in XWayland (the X11 emulation layer of Wayland). That makes sense since XWayland is not in charge of the whole screen when using a Wayland desktop.
    For my Sway desktop, I am currently using https://github.com/Hummer12007/brightnessctl with the commands
    brightnessctl 10%+ # increase brightness by 10%
    brightnessctl 10%- # decrease brightness by 10%
    That tool is not specific to Wayland. It talks directly to the backlight device exposed by the Linux kernel in /sys/class/backlight

  7. Stef says:

    Another thing that people should be aware of is that the expected behavior is that the minimum brightness value should not very dark but still visible. Unfortunately, for some graphic cards (e.g. Intel) the minimum value of 0 produces a completely black screen which can be quite annoying. I could not find a proper solution to that problem so a few months ago, I wrote a small daemon script that monitors the value reported by the backlight device are reset it to 1 when it falls to 0 (must be run a root)

    ======
    #!/bin/bash
    B=/sys/class/backlight/intel_backlight/brightness
    if [ -f $B ] ; then
    inotifywait -q -e close_write -m $B | while read -r filename event; do
    V=$(cat $B)
    if [ “$V” -eq 0 ] ; then
    echo 1 > $B
    fi
    done
    fi
    =============

    You may have to change /sys/class/backlight/intel_backlight/brightness to whatever blacklight device you are currently using.

    And of course, the script must be started at boot. For systemd user, see the example in https://www.linode.com/docs/quick-answers/linux/start-service-at-boot/

  8. Marllon says:

    Thank you so much!

  9. Jani "robsku" Saksa says:

    I don’t know why, but with Vivaldi browser, the comments are the same color as the background… All I saw was avatars and nicks, until I turned the reader-mode on, but then I couldn’t post a reply (this for is also very hard to see, white (or very-light-gray) or bright white?

    Anyway, I tried your xrandr command, and although it seems that 1.0 was the set brightness, I tried 1.2 and it worked… so I tried more, 1.3 and 1.5 – then finally 2.0, and they work – 1.0 looks dark to me now, but I know it will consume more battery, and if I just turn it back down I know I’ll get used to it in couple minutes…

    Strange… Could it be a video driver thing? You did say that the 1.0 should be the brightest possible, right?

    I’m very curious – btw, is there a panel app for screen brightness for xfce? Oh, lazy me… no, tired.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.