A simple shell script for setting backlight values
Go to file
yosh 65f1758f07 readme 2023-02-20 03:17:29 -05:00
backlightctl security funnies 2023-01-31 19:20:02 -05:00
readme.md readme 2023-02-20 03:17:29 -05:00

readme.md

backlightctl

A simple script to change the backlight brightness value on laptops. Mostly made as a workaround for this bug.

Configuration

The only configurable variable is the backlight path. It defaults to /sys/class/backlight/amdgpu_bl0. You can change BACKLIGHT_PATH (in the script itself, for security reasons bla bla bla) to point to the file path.

Usage

Usage: backlightctl [-hq] [-s VALUE] [-c VALUE]
No arguments: Print current brightness and exit
If -s and -c are specified, -c takes priority

 -h         show this help
 -q         print current brightness to stdout and exit
 -s <VALUE> set brightness to VALUE
 -c <VALUE> change brightness by VALUE

Recommendations

  • chown root:root the file
  • Move this script to /usr/local/bin
  • If your backlight isn't saved on reboot, add the following to /etc/rc.local:
/usr/local/bin/backlightctl -s <your_preferred_brightness>
  • (doas) add the following to /etc/doas.conf:
permit nopass :wheel as root cmd backlightctl
  • (sudo) add the following to /etc/sudoers (using visudo):
%wheel ALL=(ALL:ALL) NOPASSWD: /usr/local/bin/backlightctl