Brightness won't change

I am new to installing nvidia drivers in linux. What i did was running sudo nvidia-installer-dkms and the output said it was sucessfull but i still can’t change brightness of my screen. How do i fix this ?

Which DE? Edit, if its i3wm:

It’s kde and the command says it ca’nt find bindsym

bindsym XF86MonBrightnessUp exec xbacklight -inc 10 bindsym XF86MonBrightnessDown exec xbacklight -dec 10
bash: bindsym: command not found

You could try to install just xorg-xbacklight

But would be odd in kde should work out of the box. The other thread is just for i3wm.

I only could find this workaround by JamesLai (but it works).
If for whatever reason the post is losted i leave here the steps i did:

  • Install inotify-tools;
  • Create /usr/local/bin/adjust_brightness and make it executable (chmod +x) and don’t forget to change eDP option to your actual display. in my case it was DP-4:
#!/bin/sh
bl_dev=/sys/class/backlight/acpi_video0  # Modify device path to meet your brand
ratio=$(echo $(<$bl_dev/brightness) / $(<$bl_dev/max_brightness) | bc -l)
xrandr --output eDP --brightness $ratio
  • Create ~/.config/systemd/user/adjust-brightness.service:
[Unit]
Description=Adjust Screen Brightness

[Service]
Type=simple
ExecStart=/bin/bash -c "while true; do inotifywait -q -e modify /sys/class/backlight/acpi_video0/brightness; /usr/local/bin/adjust_brightness; done"

[Install]
WantedBy=default.target

  • Create ~/.config/autostart/brightness-adjuster.desktop:
[Desktop Entry]
Name=Brightness Adjuster
Exec=systemctl --user start adjust-brightness
Type=Application
Terminal=false
Comment=Adjust Brightness
  • Now reboot your pc and your brightness changes should be working.

If i found a proper solution i will post it here in the future :wink:

I’m using the following script

  • save it in file /usr/local/bin/brightness
  • make it executable: chmod +x /usr/local/bin/brightness

It accepts a percentage value between 5 to 100, e.g.

  brightness 50

It remembers the value you give it. Play with it to find the best value.

You can add it to autostart, then it will start at login.

#!/bin/bash

DIE() {
    echo "Error: $1" >&2
    exit 1
}


CheckValue1() {
    local min=5
    local max=100
    local supported_values="Supported percentage values: from $min to $max."

    if [ -z "$brightness" ] || [ -n "$(echo "$brightness" | tr -d '0-9')" ] || [ $brightness -gt $max ] || [ $brightness -lt $min ]
    then
        DIE "value '$brightness' is not supported! $supported_values"
    fi
    brightness="$(echo $brightness*0.01 | bc)"
}

Main() {
    local brightness=""
    local conf="$HOME/.config/brightness.conf"

    case "$1" in
        "")
            brightness="$(cat "$conf" 2>/dev/null)"
            if [ -n "$brightness" ] ; then
                echo "$brightness"
            else
                echo "Brightness not yet set." >&2
                return 1
            fi
            return
            ;;
        -*) DIE "unsupported parameter '$1'" ;;
        *) brightness="$1" ;;
    esac
    local storevalue="$brightness"

    CheckValue1

    local query="$(xrandr --query)"
    local output="$(echo "$query" | grep -w connected | head -n 1 | awk '{print $1}')"

    [ -n "$output" ] || DIE "no output device found!"

    xrandr --output "$output" --brightness "$brightness" || DIE "xrandr failed."

    echo "$storevalue" > "$conf"
}


Main "$@"
3 Likes