I use elementary OS Freya on a macbook pro 5,3. Can keyboard backlight be turned off after some time of inactivity ?
You could script something using
xprintidle. It will tell you how long it has been since some interaction has been done. Put it in a while loop with a
sleep command so it only checks every 5 seconds or so.
You can set the backlight to 0 using this line:
echo "0" > /sys/class/leds/smc::kbd_backlight/brightness
So the script would look like:
#!/bin/bash while true do sleep 6 if [[ $((5 * 60 * 1000)) -lt $(xprintidle) ]]; then echo "0" > /sys/class/leds/smc::kbd_backlight/brightness fi done
xprintidle returns the time in milliseconds so you need to do 5 minutes times 60 seconds times 1000 milliseconds. Change the 5 to something else if you want it to run after a different number of minutes. Run this script on startup and it will check every 6 seconds if it should turn off the backlight. It will use hardly any resources. Make sure to
chmod +x the script to make it executable.
It may be different on the MacBook Pro, but on my Dell Inspirion 17, the directory
/sys/class/leds/dell::kbd_backlight has several files of interest, particulary the one named
stop_timeout. The current contents of this file are
$ cat /sys/class/leds/dell\:\:kbd_backlight/stop_timeout 10s $
I just tried modifying the value from
60s. I then ran
xprintidle just to see if it reported any different values than it was reporting when I first looked at what the above script would be doing. The values were similar. I waited 10 seconds, and the keyboard backlight stayed on! (However the cursor in my shell stopped blinking; I'm guessing there's another file that defines that.)
I realize this isn't something official, but if it is as easy as changing a setting in a file, it's good enough for me.