gnome-shell Macbook/applesmc keyboard brightness extension

So, since this needs a bit of hacking – because of permission and such, I decided to put up a small howto on how to add an extension to gnome-shell where you can set the keyboard brightness.

First off we need to setup a bash-script who takes care of the keyboard-backlight settings.

The following script will do the trick:

#!/bin/bash
 
BACKLIGHT=$(cat /sys/class/leds/smc::kbd_backlight/brightness)
 
BACKLIGHT=$1
 
echo $BACKLIGHT | tee -a /sys/class/leds/smc::kbd_backlight/brightness
exit 0

Put that into /usr/local/bin/applekb-backlight with your favorite editor(emacs, vim, nano).

After you’ve done this(which of course needs to be sudo`ed) you need to add execution permissions to the script.

sudo chmod +x /usr/local/bin/applekb-backlight

Now the script is ready to work – you can test it by entering:

applekb-backlight [0-255]

After this i put together a gnome-shell extension who uses this script to set the brightness, just like the screen-brightness extension.

The extension can be downloaded here.

NOTE!
This is just a quick workup and need modification and error-handling to work properly, but it gives a general idea on how to solve this issue.

Of course the best solution would be to be able to use the fn + F5/F6 keys!