First, find out your hardware backlight files
ls /sys/class/backlight/
this should list the device name that controls your backlight
In our case, it is amdgpu_bl0 so we cd into that folder and see the brightness file. Brightness is stored in the file ./amdgpu_bl0/brightess
cat /sys/class/backlight/amdgpu_bl0/brightness
In Arch:
sudo pacman -S acpilight
This gives us xbacklight command ability in XFCE4 without using root
This is a bash shell script to first check whether brightness is going to completely dim the backlight to zero (display off)
# /bin/bash
min_light=$(cat /sys/class/backlight/amdgpu_bl0/brightness)
echo $min_light
if [ "$min_light" -lt 50 ]
then
echo Too Dim
else
sudo xbacklight -dec 10
fi
exit