I report here a simple procedure to set the brightness of your screen under GNU/Linux that does not rely on GUI applications, and does not rely on X11/Wayland being available on your system.
The proposed solution is based on using two keys of your choice (in the following we will use Fn+F5 and Fn+F6) to decrease/increase the current brightness of your screen. This is achieved by binding those keys through acpid to a shell script that does the dirty job.$ ls -l /sys/class/backlight/ intel_backlight $which in turns contains:
$ ls /sys/class/backlight/intel_backlight actual_brightness bl_power brightness device max_brightness power subsystem type uevent $Now, the exact pool of files you have in that folder depends on your hardware. The baseline is that there should be a file called brightness and another file called max_brightness. We don't need much more than that. So let's get started.
# apt-get install acpid acpi-supportin a terminal. If you are a luser with sudo privileges, run instead:
$ sudo apt-get install acpid acpi-supportBefore you continue, check that acpid is running:
$ ps ax | grep /usr/sbin/acpid 2084 ? Ss 5:50 /usr/sbin/acpid $You should also have some stuff in the folder /etc/acpi:
$ ls /etc/acpi always-mute.sh ejectbtn.sh lenovo-bright.sh asus-keyboard-backlight.sh events lid.sh asus-wireless.sh ibm-wireless.sh mutebtn.sh powerbtn-acpi-support.sh sleep_suspend.sh undock.sh power.sh sonybright.sh voldownbtn.sh sleep_suspendbtn.sh tosh-wireless.sh volupbtn.sh $This comes with acpi_support, usually.
#!/bin/sh if [ ! $# -le 1 ]; then echo "Usage: $0 {up|down}" exit 1; fi INCR=80 BRIGHT_FILE=/sys/class/backlight/intel_backlight/brightness min_br=0 max_br=`cat /sys/class/backlight/intel_backlight/max_brightness` act_br=`cat /sys/class/backlight/intel_backlight/actual_brightness` case $1 in up) if [ ${act_br} -le ${max_br} ]; then new_br=$((${act_br} + $INCR)); if [ ${new_br} -gt ${max_br} ]; then new_br=${max_br}; fi echo ${new_br} >> ${BRIGHT_FILE} fi ;; down) if [ ${act_br} -gt ${min_br} ]; then new_br=$((${act_br} - $INCR)); if [ ${new_br} -lt ${min_br} ]; then new_br=${min_br}; fi echo ${new_br} >> ${BRIGHT_FILE} fi ;; *) echo "Usage: $0 {up|down}" exit 1; esac
IMPORTANT Make sure that the file /etc/acpi/set-bright.sh is executable:
# chmod 755 /etc/acpi/set-bright.sh
N.B.: you might need to edit the variables BRIGHT_FILE, INCR, max_br, and act_br to reflect your hardware configuration and/or your personal preferences.
$ acpi_listenThis command prints on output the name of the acpi event associated to each button you press, until you hit Ctrl+C to terminate it. For instance, if I type Fn+F5 followed by Fn+F6 in my system I see:
$ acpi_listen video/brightnessdown BRTDN 00000087 00000000 video/brightnessup BRTUP 00000086 00000000Note down the names of the events associated to Fn+F5 and Fn+F6 (you'll need them in a moment) and hit Ctrl+C to terminate acpi_listen.
Now as user root open the file /etc/acpi/events/brightup:
# editor /etc/acpi/events/brightupand be sure that it contains (at least) something like:
event=video[ /]brightnessup action=/etc/acpi/set-bright.sh upNotice that the first line (event=video...) is referring to the event video/brightnessup, that is the event generated by Fn+F6. The associated action is to call the script /etc/acpi/lenovo-bright.sh up
Now repeat the process described above and make sure that the file /etc/acpi/events/brightdown contains something like:
event=video[ /]brightnessdown action=/etc/acpi/set-bright.sh down
After having saved those two files, just restart acpid:
# /etc/init.d/acpid restartand adjust your brightness as you like.
HTH
KatolaZ