SEARCH

Enter your search query in the box above ^, or use the forum search tool.

You are not logged in.

#1 2013-05-27 19:04:02

Frostlock
Member
From: Belgium
Registered: 2013-05-27
Posts: 34

MacBook Pro - Enable keyboard backlight

In this post I'll explain how to get the MacBook Pro keyboard backlight to work in crunchbang Waldorf.

I run a dual boot config with OS X 10.6.8 Snow Leopard and Crunchbang Waldorf 64-bit on a MacBookPro 5.5.
I have enjoyed Crunchbang for a while but it is a shame to have a keyboard with nice backlights if they don't light up. Luckily there is a solution and it is not very difficult.

First things first: credit to where I found a lot of help and inspiration to make it work:
http://www.mabishu.com/blog/2010/06/24/ … -gnulinux/
This useful post has more information and a nice script you can use to tune your keyboard backlight up and down.

1 - test to see if you can activate the lights
Waldorf comes with the required applesmc module loaded. You can test to see if you can activate the lights using the following code. You should see your lights go on and off.

#Test using the lines below in a terminal
sudo su
echo 255 > /sys/class/leds/smc::kbd_backlight/brightness
echo 0 > /sys/class/leds/smc::kbd_backlight/brightness

2- Install the backlight script
Grab the script from the link above and place it where you like on your system. I used the bin directory of my home folder. I will use /home/userid/bin/keyboard-light as example for the config below. Make sure the script can be executed (chmod a+x).

The script has to be called using sudo, adapt the sudoers file to allow usage without password. Add the following in your sudoers file: (you need to do this using visudo: sudo visudo -f /etc/sudoers)

#Lines added to enable backlight keys
Cmnd_Alias CMDS = /home/userid/bin/keyboard-light
%sudo ALL = (ALL) NOPASSWD: CMDS

3 - Bind the script to the correct backlight keys
Final step is to bind the script to the correct backlight keys on the MacBook keyboard. Some searching learns that the keys on my keyboard have the following names:
   XF86KbdBrightnessDown
   XF86KbdBrightnessUp
If you want to use different keys you can use ‘xev’ to determine the proper key names.
The actual binding is done in the openbox rc.xml configuration file. Add the following piece of code in the rc.xml keybindings section.  (geany .config/openbox/rc.xml). Make sure you put in the correct path to the script.

    <!-- BEGIN keyboard backlight -->
    <keybind key="XF86KbdBrightnessDown">
      <action name="Execute">
        <command>sudo /home/userid/bin/keyboard-light down</command>
      </action>
    </keybind>
    <keybind key="XF86KbdBrightnessUp">
      <action name="Execute">
        <command>sudo /home/userid/bin/keyboard-light up</command>
      </action>
    </keybind>
    <!-- END keyboard backlight -->

4 - Done
Restart openbox and your keys should allow to tune your keyboard backlight up and down.
Now you can enjoy crunchbang on your MacBook Pro in pitch black darkness, hurray!

Offline

Help fund CrunchBang, donate to the project!

#2 2013-05-31 18:12:01

Poohblah
Member
Registered: 2013-05-29
Posts: 13

Re: MacBook Pro - Enable keyboard backlight

Awesome writeup! I tested it and confirmed that it works on a MacBook Air. However I have not set these particular keybindings permanently because I find the backlight to be obnoxious and a waste of battery, but that is just personal preference.

Offline

#3 2013-05-31 19:03:35

Frostlock
Member
From: Belgium
Registered: 2013-05-27
Posts: 34

Re: MacBook Pro - Enable keyboard backlight

Thanks for testing!

Offline

#4 2013-07-15 08:52:12

Distrohopper79
New Member
From: Braunschweig
Registered: 2013-05-08
Posts: 5

Re: MacBook Pro - Enable keyboard backlight

Another way (tested on my MacBook Pro Mid 2009):

sudo apt-get install pommed

You can configure this in:

/etc/pommed.conf

Offline

#5 2014-08-30 08:33:57

nwjlyons
New Member
From: Belfast, UK
Registered: 2014-02-07
Posts: 8
Website

Re: MacBook Pro - Enable keyboard backlight

@Frostlock thanks for your instructions. I've expanded them to wire up my laptop fan and also to give me fine control over screen brightness to some other unused function keys.

I don't know why but my laptop fan was always on the lowest possible setting even when it got really hot. Now I can use the "next song" button to up the fan speed smile

The end result of following this gist https://gist.github.com/nwjlyons/b29ee6f7e26595f55a2a is:

  • F3/F4 adjust screen brightness using intervals of 1. F1/F2 use intervals of 10.

  • F5/F6 adjusts keyboard brightness.

  • F7/F9 adjusts laptop fan speed.

Last edited by nwjlyons (2014-08-30 08:42:19)

Offline

Board footer

Powered by FluxBB

Copyright © 2012 CrunchBang Linux.
Proudly powered by Debian. Hosted by Linode.
Debian is a registered trademark of Software in the Public Interest, Inc.
Server: zapp

Debian Logo