I had some spare time today (!) and made a simple script that you might find interesting.
It requires 'sudo' unfortunately. But if you pass a value, it will dim or brighten the backlight. Passing "10" will increase the parameter by 10, passing "-15" will decrease the parameter by 15. I used xbindkeys and bound this script to the Alt comma and Alt period keys:
You might prefer to use Mod4 + F1 and Mod4 + F2 (which is Pine + F1 and Pine + F2). As you can see, I did not because I have those in use already. We cannot use Fn + F1 and Fn + F2 because the keyboard firmware returns both keys as the same single key.
I run this as a script at KDE startup, but you could put it in .xinitrc:
Surely there is a better way to do this, but until we get support for whatever the keyboard firmware does, it works. I'm not any kind of Unix guru, and I barely know how to make shell scripts work.
Code:
$ cat ~/s/ModBright
#!/bin/sh
level=`cat ~/.backlightlevel`
level=$(( $level + $1 ))
if [ "$level" -lt "0" ]; then
level=0
fi
if [ "$level" -gt "255" ]; then
level=255
fi
echo $level > ~/.backlightlevel
sudo sysctl -w hw.pwmbacklight0.level=$level
It requires 'sudo' unfortunately. But if you pass a value, it will dim or brighten the backlight. Passing "10" will increase the parameter by 10, passing "-15" will decrease the parameter by 15. I used xbindkeys and bound this script to the Alt comma and Alt period keys:
Code:
$ cat ~/.xbindkeysrc
#Mod4 is the Pine key
"konsole"
Mod4 + F1
"firefox78"
Mod4 + F2
"sh ~/s/ModBright -10"
Alt + comma
"sh ~/s/ModBright 10"
Alt + period
You might prefer to use Mod4 + F1 and Mod4 + F2 (which is Pine + F1 and Pine + F2). As you can see, I did not because I have those in use already. We cannot use Fn + F1 and Fn + F2 because the keyboard firmware returns both keys as the same single key.
I run this as a script at KDE startup, but you could put it in .xinitrc:
Code:
sysctl -n hw.pwmbacklight0.level > ~/.backlightlevel
xbindkeys
Surely there is a better way to do this, but until we get support for whatever the keyboard firmware does, it works. I'm not any kind of Unix guru, and I barely know how to make shell scripts work.