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 "$@"
2 Likes

brightnessctl is a utility that can be used to control screen brightness in Linux, and it can be used with i3 window manager. To use brightnessctl with i3, you’ll first need to install the brightnessctl package from your Linux distribution’s package manager.

Once you have brightnessctl installed, you can use it to set the screen brightness in i3 by binding it to a keyboard shortcut. For example, you can add the following lines to your i3 configuration file (~/.config/i3/config) to bind the XF86MonBrightnessUp and XF86MonBrightnessDown keys to increase and decrease screen brightness, respectively:

bashCopy code

bindsym XF86MonBrightnessUp exec "brightnessctl set +10%"
bindsym XF86MonBrightnessDown exec "brightnessctl set 10%-"

In this example, the brightnessctl command is used to adjust the screen brightness. The set option is used to set the brightness level by a specified amount, in this case, +10% or -10%. You can adjust the amount by which the brightness changes to your preference.

After adding these lines to your i3 configuration file, save the file and restart i3 (by pressing Mod+Shift+r, where Mod is the key you’ve configured as the i3 modifier key) for the changes to take effect.

i leave the post here… but consider not necrodump old threads :wink:
–closing–

Anyway welcome @devventure and have fun at your purple journey :enos:

1 Like