I've installed Ubuntu 13.04, everything seems fine except using the Fn key to change the laptop's brightness.

It just stays permanently on full brightness.

Even if I go into System Settings and change the brightness with the slider, it stays at full.

  • Try my answer Here, it might help. – Mitch Jul 6 '13 at 21:45

If your willing to use a bit of a hack, this might work.

My Dell Inspiron had the exact same problem, so I came up with this little python script and a couple of minor changes.

I'm not sure how universal it is, but my computer has a file called "brightness" in the path "/sys/class/backlight/intel_backlight" which this script depends on. If that is not present then this solution will likely not work.

Assuming that is there, the next step is to give ourselves permission to write to it. We'll add this line to "/etc/rc.local" so that it is executed at startup automatically. I used nano to edit it. Gedit doesn't seem to work. So in the terminal (Ctrl + Alt + T):

$ sudo nano /etc/rc.local

Add this line before exit 0:

chmod 666 /sys/class/backlight/intel_backlight/brightness

If you want to be able to test this without a reboot, you can run that same command now as root:

sudo chmod 666 /sys/class/backlight/intel_backlight/brightness

Now we, as a normal user can change the brightness through that file. But instead of editing that file for each brightness change, let's use a simple python script:

#!/usr/bin/env python

from sys import argv

import os

PATH = "/sys/class/backlight/intel_backlight"        # You shouldn't have to change this,
                                                     # if you need to and you know what
                                                     # you're doing, go ahead.

def getMax():
    maxFile = open(os.path.join(PATH, "max_brightness"))
    ret = int(maxFile.readline())

    return ret

MAX = getMax()
MIN = 200                # You can change 200. My 0 was literally black (I could not see
                         # the screen), so play around with that.

INC = (MAX-MIN)/8        # You can change 8. It is approximately how many times you have
                         # to change the brightness before it goes from MAX to MIN, or
                         # vice versa.

def getCurrentBrightness():
    curBrightnessFile = open(os.path.join(PATH, "brightness"))
    return int(curBrightnessFile.readline())

def setBrightness(newValue):
    brightnessFile = open(os.path.join(PATH, "brightness"), "w")



def up(increment = INC):

def down(decrement = INC):

def change(increment):
    curBrightness = getCurrentBrightness()

    newBrightness = constrain(curBrightness + increment)


def constrain(value):
    if value >= MAX: print "MAX"
    if value 

Now, copy that code into a file and save it wherever you like. You can end the name in ".py" as is the python tradition, but it is not required. Now make it executable. Either you can find it in Files, right click on it, click properties, click the permissions tab in the top, and make sure "Allow executing file as a program" is checked. Or you can navigate to it in the terminal and run this:

$ chmod +x /Path/to/file.py

Next, copy the path to the file, or remember it; make sure you have it. Go to "System Settings" > "Keyboard" > "Shortcuts" > "Custom Shortcuts". Click the "+" button in the bottom. For the name you can put "Brighten Screen". For command, put the path to the python script. If there are spaces in the path, surround it in quotes. After the path (outside of the quotes) put a space, and then "up".

"/path to/the/python script.py" up

Do this again, but use "Dim Screen" for the name, and use "down" instead of "up".

"/path to/the/python script.py" down

If you click on the "Disabled" label to the right, you can assign keyboard shortcuts to these commands. I tried the original Fn keys, but they did not seem to work, so I used <Alt-Up> and <Alt-Down> instead. This can also be run from the terminal by executing the file, but the keyboard shortcuts make a lot more sense, and are much more like the original Fn keys.

I put a couple of comments in the code (lines followed by a "#") mentioning numbers you could change to make it work better for you that you might take a look at.

This seems ridiculously complex when I write it out here, but it probably took me two minutes to actually add to my system (plus the python), so I think it should go pretty smoothly.

I hope this helps. Good Luck!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.