DEV Community

Jacopo Valanzano
Jacopo Valanzano

Posted on

Linux Display Brightness

If you use the beloved X11, you might occasionally encounter difficulties adjusting the screen brightness. This is especially true if your system has a discrete GPU.

To overcome this issue, here are two simple Bash commands designed to gradually increase and decrease the screen brightness:

increaseBrightness(){
        xrandr --output eDP-1-1 --brightness $(bc <<< $(xrandr --verbose | grep -m 1 -i Brightness | cut -f2 -d ' ')+0.01 );
}

decreaseBrightness(){
        xrandr --output eDP-1-1 --brightness $(bc <<< $(xrandr --verbose | grep -m 1 -i Brightness | cut -f2 -d ' ')-0.01 );
}
Enter fullscreen mode Exit fullscreen mode

Use xrandr to find the Embedded DisplayPort (eDP) connection, if needed.

You can also create aliases to make your life easier:

# Increase Brightness
alias increaseBrightness="increaseBrightness"
# Decrease Brightness
alias decreaseBrightness="decreaseBrightness"
Enter fullscreen mode Exit fullscreen mode

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

Top comments (0)

Billboard image

Create up to 10 Postgres Databases on Neon's free plan.

If you're starting a new project, Neon has got your databases covered. No credit cards. No trials. No getting in your way.

Try Neon for Free →