Dim Backlight on a Laptop with Sway after a Timeout
The backlight on a laptop is one of the most power intensive parts. Sometimes, you want to quickly turn it off or dim it after a short timeout.
NOTE: While this is fine on LED backlit displays, I would NOT recommend it on older CCFL backlit displays.
swayidle
can be used for this task!
swayidle -w timeout 15 'light -O && light -S 0' resume 'light -I'
Here is a simple line that uses the 'light' utility to set backlight.
After 15 seconds of being idle, it will save the current level, dim the backlight to 0, and on resume, restore the saved value.