Skip to content

Instantly share code, notes, and snippets.

@BinToss
Last active April 17, 2026 23:35
Show Gist options
  • Select an option

  • Save BinToss/ca2b47df31dd7cf13e9fe00f7bbefab4 to your computer and use it in GitHub Desktop.

Select an option

Save BinToss/ca2b47df31dd7cf13e9fe00f7bbefab4 to your computer and use it in GitHub Desktop.
Linux Maximize Backlight Brightness

fullbright

This shell script, fullbright, selects one of your backlight of one of your displays and (if its backlight brightness is not maximized) sets the backlight to the value found in its max_brightness file.

At the time of writing, this script will only attempt to maximize the brightness of the first backlight it finds; It does not have a Choice prompt.

#!/bin/sh
# Version: 1.0.0
# INSTALL/UPDATE:
# > curl https://gist.githubusercontent.com/BinToss/ca2b47df31dd7cf13e9fe00f7bbefab4/raw/fullbright.sh -o ~/.local/bin/fullbright && chmod 755 ~/.local/bin/fullbright
# intel_backlight (Intel), amdgpu_bl0 (AMD), nvidia_wmi_ec_backlight (NVIDIA), acpi_video0 (ATI, generic)
# blMgrs=intel_backlight,amdgpu_bl0,nvidia_wmi_ec_backlight,acpi_video0
blMgrsActual="$(/bin/ls -N1 /sys/class/backlight/)"
blMgr=""
case "$blMgrsActual" in
*"\n"* )
# TODO: add choice-prompt when multiple backlights
set -- "$blMgrsActual"
blMgr=${1};;
* )
blMgr="$blMgrsActual";;
esac
if [ "$blMgr" -eq "" ]
then
echo "No backlight selected!"
exit 1;
fi
pathBrightness=/sys/class/backlight/$blMgr/brightness
pathMaxBrightness=/sys/class/backlight/$blMgr/max_brightness
if [ "$(cat "$pathBrightness")" -eq "$(cat "$pathMaxBrightness")" ]
then echo "'$blMgr' is already at max brightness" && exit
fi
# if not root (assuming we must be root to write to backlight)
# then request re-run as root
if [ "$(id -u)" -gt 0 ]
then
if [ -z "$PS1" ]
then pkexec "$0"
else sudo "$0"
fi
exit
fi
echo 96000 > "$pathBrightness"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment