LightScript - Lightweight script to easily change screen brightness.

Official site:
My first package, be gentle
Created this script because of 3 reasons:
1. KDE's controller for backlight is really buggy for me, makes it unusable.
2. xbacklight does not work well with multiple controllers for the same device (I get 7 stages of resolution instead of 4882).
3. I like scripting/doing my own work.
What it does?
LightScript automatically detects the best backlight-controller based off its precision/resolution, and uses that controller to set the backlight to a value you specify in percent.
Example: "light 30" <- Set brightness to 30%
If sudo is installed, it will attempt to use this instead of forcing root (so you wont have to type "sudo light x" instead of just "light x").
It also has a default minimum-cap of 5%, since some controllers turn the display pitchblack on 0%. This behaviour can be overridden by changing /etc/lightscript/minlight
Since version 0.3.6 the script now also takes + and - operators, so you can increase and decrease brightness instead of just giving a fixed value.
It also checks for filepermissions on controllers before deciding wether to force root/use sudo etc.
Example: "light 10+" <- Increase brightness by 10%
0.3.6 also came with 2 small issues that is on my todolist; Firstly, typing "light +" or "light -" will give expr errors, nothing dangerous though. Secondly, the output on dynamic changes(with operators) might shift with 1-2% when mixed with regular changes. This is only what you see though, internally everything works fine, it will still write the correct values to the controllers.
Since version 0.3.5 the script has undergone huge internal changes (basically rewrote big parts of the script to make it more consistant and futuresafe, removed dependencies, gave a prettier output as well as more information etc)
Find any bugs? Have any feedback? Dont hesitate to reply
PS. I am aware that this might not be preferrable to most people (if xbacklight/other software they use works well), I just want to share my work with the community (especially since it is my first real bash script, also I get to practice AUR-packaging for upcoming c++-made-software!)
Last edited by Haikarainen (2012-10-01 17:50:18)

The script has been successfully ported to an ANSI C89-program!
Its commandline options is really different from lightscripts,  but internally it works the same way. I've also added functionality per requests I've gotten, I'll let the programs output speak for itself:
fredrik@fredrik-arch ~/projects/light % ./light [20:07:53]
Usage: light [-qcas] <value>
-q: Run quiet, supresses output.
-c: Prints the current brightness in percent and exits.(Not precise)
-p: Prints the current brightness directly from controller and exits. (Precise)
-m: Prints the max brightness directly from controller and exits. (To be used side-by-side with -p)
-a: Add the value instead of setting it.
-s: Subtract the value instead of setting it.
<value> Brightness wanted in percent.
I'll package this under a different name tomorrow(since it's now a completely different product), stay tuned!

Similar Messages

  • Change screen brightness - maverick

    How do you change screen brightness under Maverick, no system preferences address this.  F1 and F2 keys do not affect brightness.

    Try reseting the smc see
    the F1 and F2 keys are still used for brightness.

  • Unable to change screen brightness

    I have an X100E and sometimes when it comes out of sleep I am unable to change the screen brightness. Pressing Fn-Del or Fn-Home just brings up the on-screen brightness indicator but it doesn't change. The only way I've found to be able to change brightness again is to reboot.
    It seems that it happens if it goes into sleep when plugged in and comes out on battery, or vice versa, but not always. There doesn't seem to be a correlation to uptime either. I've had it happen after an hour or two up and I've had it happen 7 days up.
    I am running Win7 Pro.

    Google it a bit and you'll see it is a known issue in Windows 7 with several laptop manufacturers.  BIOS will not help in this case.   I also have the problem - everytime I hibernate and wake.  I have Win7 Pro x64.
    Simple workaround I found was to close and reopen the lid (as long as "Close lid" is set to "do nothing" in Power Manager settings.  This cycles power on the screen and that somehow resets things until the next time you sleep/hibernate.  However, it is strange that cycling the power on the screen using Power Manager "power off display" does not reset it - no effect.
    I have my x100 set to:
    Power button: Hibernate
    Close lid: Nothing
    Fn+F4: Sleep

  • Cannot change screen brightness on HP pavilion DV6

    after changing from win 7 home  basic to win7 ultimate 64bit cannot change screen brightnes with function keys 
    HP Pavilion dv6-3055sr
    P/N: WY940EA
    Please help.

    Hello Roma89,
    Welcome to the HP Forums, I hope you enjoy your experience! To help you get the most out of the HP Forums I would like to direct your attention to the HP Forums Guide First Time Here? Learn How to Post and More.
    I understand that since you upgrade from Windows 7 Home to Windows 7 Ultimate you have been unable to adjust the screen brightness using the Functions keys. I would suggest that you download and install the newest version of the HP Support Assistant which if you follow the HP Support document: Using HP Support Assistant (Windows 7) should get you all the newest drivers for your computer.
    Please re-post if you have any further issues. Thank you for posting on the HP Forums. Have a great day!
    Please click the "Thumbs Up" on the bottom right of this post to say thank you if you appreciate the support I provide!
    Also be sure to mark my post as “Accept as Solution" if you feel my post solved your issue, it will help others who face the same challenge find the same solution.
    I work on behalf of HP
    Find out a bit more about me by checking out my profile!
    "Customers don’t expect you to be perfect. They do expect you to fix things when they go wrong." ~ Donald Porter

  • U400 Unable to change screen brightness

    just got my u400 couple days back
    only realised today that i am unable to change the screen brightness through the notebook"s shortcut keys or directly via the control panel
    anybody ever encountered this??

    I see.. thank u for ur reply.
    Anybody encountering my problem?? Hope its just something minor. Hate to send it back to service after settting up everything

  • Completely unsolvable: Cannot change screen brightness after I upgraded my ThinkPad's display.

    I have a ThinkPad X240 which came with a 1366x768 TN panel, I hated it and so after a while I upgraded it to an IPS 1080p display. It works great and looks fantastic except it's stuck on max brightness inside of Windows 8.1. I cannot change the brightness inside of Intel HD graphics settings or inside of programs like Display Tuner. It doesn't work in Windows 10 either. The weird thing is, I can change the brightness just fine inside of Ubuntu. I've tried uninstalling the Intel HD drivers and reinstalling them, I've tried switching the drivers to the Microsoft Basic Display Adapter, and none has worked. I feel like I've installed every single version of Intel's Graphics Drivers and that I've done everything and it still won't change the bloody brightness. NOTHING has worked except to just use Ubuntu, which is not an adequate solution. I've even gone as far as to update my BIOS and reset it to defaults, I've even pulled the CMOS battery. I've tried the version of the Intel HD driver from Lenovo for the X240 and I've installed the monitor.ini files. I've also just learned that during the Windows Boot Logo, the FN keys WILL change the brightness, but as soon as Windows is done booting, it stops working. This, coupled with the fact that brightness control works in Ubuntu means that this must be something related to Windows right? Brightness control works in BIOS. I've even gone so far as to try and change the brightness through CMD using powercfg according to this post. I'm really starting to lose patience now as it has been like this for 3 weeks and I can't be using Ubuntu all of the time, I honestly do not know what to do, it seems like this problem is completely unsolvable. Edit: I even got so frustrated that I switched off the laptop, installed the old screen, booted up Windows, and the brightness worked. Then (I know this is a bad idea) WHILE IT WAS ON, I pulled the old display and put connected the new one. And lo and behold, the brightness **bleep**ING worked in windows on the new display.

    try change drivers
    Moderator comment: Post edited to conform with the Community Rules guidelines.
    "No posts or signatures with intent to promote or advertise
    Any way of personal blogs/ websites/ pages/ affiliated websites/ resources are not allowed."

  • How to change screen brightness on bootcamp 5.0.2 in Windows 8?

    I have a retina MacBook Pro which i used bootcamp to install windows 8 on. However, i cannot change the brightness with my F1/F2 key.
    Any solutions?

    I would look in the ati/amd or nvidia settings tool

  • Change Screen Brightness

    Is there any way to adjust the brightness of the screen in Adobe Air for Desktop (running in Windows 8.1)?
    I have an app that I want to always run at full screen brightness.
    If not, does anyone know of any ANEs that will work?
    If also not, does anyone know where to find a tutorial on making ANEs?

    I you not familar with Native Extensions and C++ / C - you can try avoid using it using already done external apps. Just find one that can work in background so users will not see it. go there and download simple app.
    Using executing NativeProcess you can run it. But before you can edit Opacity value in XML. So scheme may be next:
    1) using adobe air edit xml and update opacity value
    2) attach listener to main app exit so when you close it - you also must termiate your Dimmer
    3) run Dimmer with NativeProcess API from Adobe Air
    4) when you exit from main app - listener from step 2 will fire and you must close Dimmer from step using exit() method
    This app actually not reduce brightness and just add black overlay with opacity. In most cases it's work prefectly. When you need to terminate external NativeProcess just call exit()
    You may note that if you have some external app that can cover your functionality - better to use it instead developing own DLL Because Developing DLLs require addition skills.

  • Program to change screen brightness?

    Does anyone know of a program that will lower the screen brightness beyond that available of the second lowest bright level (ie not the no backlight at all option) pre-set on the mac? I find the screen is quite bright at this setting, and would be willing to go even darker to save some battery power...

    Not an answer to your question, but anyway:
    System Preferences, Display shows a slider to set the brightness. Though this seems to be a linear slider, setting it between two discrete values (such as set using the fn-F1 and f1-F2 keys) does not actually seem to give a different brightness.
    Furthermore, for battery usage the Energy Saver options include "Reduce the brightness of the built-in display when using this power source". This option in fact only works when the normal brightness is at least twice the minimum value. When the normal brightness for AC power is set to its minimum then unplugging AC power does not reduce the brightness any further.
    So: I doubt you'll find the program you're looking for.
    By the way: did you compare the brightness of your screen to other MacBooks? On my MacBook less than the lowest brightness would hardly be sufficient unless working in a room with candlelight
    MacBook 2GHz 2GB   Mac OS X (10.4.8)  

  • Screen brightness wont change

    For my HP Pavilion 15-e017tx.
    It was working fine till yesterday. But today when i tried to change screen brightness it wont change.
    I did it from the special keys provided for it and also from the windows mobility center.
    Tried to change the Power plan as well.
    Restarting the system also didnt help.
    Please let me know what to do about it.

    Try doing System Restore to a previous good state, at least 24-hours before the problem started:
    ++Please click KUDOS / White thumb to say thanks
    ++Please click ACCEPT AS SOLUTION to help others, find this solution faster
    **I'm a Volunteer, I do not work for HP**

  • T420s - screen brightness increases and decreases

    I have noticed on my T420s that screen changes screen brightness depending on the picture on the screen.
    For example:
    - I look at some site with dark background and few grey letters
    when I switch screen to my outlook or for example firefox with this forum that has white background at first few minutes white is gray and then it gradually becomes whiter and whiter until after about 2 seconds it settles.
    I thought at first my eyes have issue, but it is definetly behaviour of my laptop.
    Anyone with the same issue? Can this be fixed by some software/power manager tweak?
    Go to Solution.

    Yes, I run it on battery and with Intel HD
    It is display power saving thing - thank you

  • HAL and screen brightness

    So for some reason I could change screen brightness, but only by setting the default in gnome-power-manager. In order to get the function keys to work too I had to play around with HAL config (using an example I found in an ubuntu bug report)
    Given that HAL is now deprecated, what is replacing it for handling screen brightness?

    pl give the details of your graphics card. in some cases you need to use  setpci command. Most of the Intel integrated graphics work out of box. For latest nvidia cards still some issues to be resolved.

  • Default Screen Brightness

    I installed a fresh copy of Leopard. I have changed screen brightness and want to restore it the way it was before I changed it. I tried looking in my Preference folder, but no avail. I know it may sound a bit odd but I just want it back. I know for my sound setting, it is 11 blocks from the left.

    It is not a "trouble" really. I do not know if the brightness is too high when booting the computer. I will see to see how many "blocks" it occupied. No I have not checked in Snow Leopard forum, I thought my issue is realated to the MacBook than the software? Should I consider posting it there?

  • [FIXED] after upgrade ACPI can no longer change my screen brightness

    EDIT: never mind, it seems to of gone away now...i have no idea what happened, it stopped working randomly then started working just as randomly.....whatever...
    Just yesterday i was using my laptop with arch linux with the brightness turned all the way down, as of course it saves battery
    but now i turn it on today and the screen is at maximum brightness, and every time i try to change it it just says (in kernel.log) :
    Sep  8 10:28:46 Polygon kernel: ACPI: Failed to switch the brightness
    Sep  8 10:28:46 Polygon kernel: ACPI: Failed to switch the brightness
    so...what got upgraded that broke this? does anyone else have this problem?
    here is the past few days of my pacman.log: (it has some entries for kernel-my, a custom compiled kernel, but i get no screen brightness control on my custom compiled kernel, or the default arch one)
    [2009-09-01 11:24] >>> Updating module dependencies. Please wait ...
    [2009-09-01 11:24] installed kernel26-my (2.6.28-1)
    [2009-09-01 11:25] >>> Updating module dependencies. Please wait ...
    [2009-09-01 11:25] upgraded kernel26-my (2.6.28-1 -> 2.6.28-1)
    [2009-09-01 11:26] >>> Updating module dependencies. Please wait ...
    [2009-09-01 11:26] upgraded kernel26-my (2.6.28-1 -> 2.6.28-1)
    [2009-09-01 11:29] >>> Updating module dependencies. Please wait ...
    [2009-09-01 11:29] upgraded kernel26-my (2.6.28-1 -> 2.6.28-1)
    [2009-09-01 11:30] >>> Updating module dependencies. Please wait ...
    [2009-09-01 11:30] upgraded kernel26-my (2.6.28-1 -> 2.6.28-1)
    [2009-09-01 11:34] removed kernel26-my (2.6.28-1)
    [2009-09-01 11:34] >>> Updating module dependencies. Please wait ...
    [2009-09-01 11:34] installed kernel26-my (2.6.28-1)
    [2009-09-01 11:38] >>> Updating module dependencies. Please wait ...
    [2009-09-01 11:38] upgraded kernel26-my (2.6.28-1 -> 2.6.28-1)
    [2009-09-01 11:40] >>> Updating module dependencies. Please wait ...
    [2009-09-01 11:40] upgraded kernel26-my (2.6.28-1 -> 2.6.28-1)
    [2009-09-01 11:40] >>> Updating module dependencies. Please wait ...
    [2009-09-01 11:40] upgraded kernel26-my (2.6.28-1 -> 2.6.28-1)
    [2009-09-01 11:42] >>> Updating module dependencies. Please wait ...
    [2009-09-01 11:42] upgraded kernel26-my (2.6.28-1 -> 2.6.28-1)
    [2009-09-01 11:46] removed kernel26-my (2.6.28-1)
    [2009-09-01 11:47] >>> Updating module dependencies. Please wait ...
    [2009-09-01 11:47] installed kernel26-my (2.6.28-1)
    [2009-09-01 12:21] installed rsync (3.0.6-1)
    [2009-09-01 12:21] installed abs (2.3.3-1)
    [2009-09-01 12:32] installed nvidia_arch-mark-grandi (185.18.36-1)
    [2009-09-01 13:01] synchronizing package lists
    [2009-09-01 13:02] starting full system upgrade
    [2009-09-01 13:03] upgraded python3 (3.1-2 -> 3.1.1-1)
    [2009-09-02 09:22] synchronizing package lists
    [2009-09-02 09:23] starting full system upgrade
    [2009-09-02 09:23] upgraded coreutils (7.4-1 -> 7.5-1)
    [2009-09-02 09:23] upgraded libarchive (2.7.0-2 -> 2.7.1-1)
    [2009-09-02 09:23] upgraded module-init-tools (3.8-1 -> 3.10-1)
    [2009-09-02 09:23] upgraded raptor (1.4.18-1 -> 1.4.19-1)
    [2009-09-02 09:23] upgraded redland (1.0.8-3 -> 1.0.9-1)
    [2009-09-02 09:23] upgraded syslog-ng (3.0.3-2 -> 3.0.4-1)
    [2009-09-02 12:11] removed kernel26-my (2.6.28-1)
    [2009-09-02 12:30] >>> Updating module dependencies. Please wait ...
    [2009-09-02 12:30] installed kernel26-my (2.6.28-1)
    [2009-09-02 12:52] removed nvidia_arch-mark-grandi (185.18.36-1)
    [2009-09-02 12:53] installed nvidia_arch-mark-grandi_ver2 (185.18.36-1)
    [2009-09-03 10:23] synchronizing package lists
    [2009-09-03 10:24] starting full system upgrade
    [2009-09-03 19:34] synchronizing package lists
    [2009-09-03 19:35] starting full system upgrade
    [2009-09-04 09:08] synchronizing package lists
    [2009-09-04 09:09] starting full system upgrade
    [2009-09-04 12:27] synchronizing package lists
    [2009-09-04 12:27] starting full system upgrade
    [2009-09-04 12:28] upgraded apr (1.3.8-1 -> 1.3.8-2)
    [2009-09-04 12:28] upgraded damageproto (1.1.0-2 -> 1.2.0-1)
    [2009-09-04 12:28] upgraded dmxproto (2.2.2-2 ->
    [2009-09-04 12:28] upgraded fontsproto (2.0.2-2 -> 2.1.0-1)
    [2009-09-04 12:28] upgraded videoproto (2.2.2-2 -> 2.3.0-1)
    [2009-09-04 12:28] upgraded xf86dgaproto (2.0.3-2 ->
    [2009-09-04 12:28] upgraded xf86vidmodeproto (2.2.2-2 ->
    [2009-09-04 12:28] upgraded xineramaproto (1.1.2-2 ->
    [2009-09-04 12:29] installed pyxdg (0.17-1)
    [2009-09-04 12:29] installed setuptools (0.6c9-2)
    [2009-09-04 12:29] installed libtorrent-rasterbar (0.14.4-2)
    [2009-09-04 12:29]
    [2009-09-04 12:29] >>> Deluge's daemon is running with the "deluge" user. The default download directory is /srv/deluge/
    [2009-09-04 12:29]
    [2009-09-04 12:29] installed deluge (1.1.9-2)
    [2009-09-04 12:29] installed python-chardet (1.0.1-2)
    [2009-09-04 19:58] synchronizing package lists
    [2009-09-04 19:59] starting full system upgrade
    [2009-09-06 12:47] synchronizing package lists
    [2009-09-06 12:48] starting full system upgrade
    [2009-09-06 12:48] upgraded cloog-ppl (0.15.3-1 -> 0.15.7-1)
    [2009-09-06 12:48] upgraded gnupg (1.4.9-4 -> 1.4.10-1)
    [2009-09-06 12:48] upgraded gstreamer0.10-bad (0.10.13-1 -> 0.10.14-1)
    [2009-09-06 12:48] upgraded gstreamer0.10-bad-plugins (0.10.13-1 -> 0.10.14-1)
    [2009-09-06 12:48] upgraded gstreamer0.10-good (0.10.15-3 -> 0.10.16-1)
    [2009-09-06 12:48] upgraded gstreamer0.10-good-plugins (0.10.15-3 -> 0.10.16-1)
    [2009-09-06 12:48] upgraded libdrm (2.4.12-1 -> 2.4.13-1)
    [2009-09-06 12:48] upgraded libfontenc (1.0.4-2 -> 1.0.5-1)
    [2009-09-06 12:48] upgraded libice (1.0.5-1 -> 1.0.6-1)
    [2009-09-06 12:49] upgraded libpciaccess (0.10.6-1 -> 0.10.8-1)
    [2009-09-06 12:49] upgraded libxau (1.0.4-1 -> 1.0.5-1)
    [2009-09-06 12:49] upgraded libxcursor (1.1.9-2 -> 1.1.10-1)
    [2009-09-06 12:49] upgraded libxinerama (1.0.3-2 ->
    [2009-09-06 12:49] upgraded libxxf86dga (1.0.2-2 ->
    [2009-09-06 12:49] upgraded libxxf86vm (1.0.2-1 ->
    [2009-09-06 12:49] upgraded man-db (2.5.5-2 -> 2.5.6-1)
    [2009-09-06 12:49] upgraded mesa (7.5-2 -> 7.5.1-2)
    [2009-09-06 12:49] upgraded nss ( -> 3.12.4-1)
    [2009-09-06 12:49] upgraded pixman (0.14.0-2 -> 0.16.0-1)
    [2009-09-06 12:49] installed rasqal (0.9.16-1)
    [2009-09-06 12:49] upgraded redland (1.0.9-1 -> 1.0.9-2)
    [2009-09-06 12:49] upgraded xf86-input-synaptics (1.1.2-2 -> 1.1.3-1)
    [2009-09-06 12:49] upgraded xorg-font-utils (7.4-2 -> 7.4-3)
    [2009-09-06 12:49] upgraded xorg-server (1.6.3-4 ->
    [2009-09-06 17:54] synchronizing package lists
    [2009-09-06 17:54] starting full system upgrade
    [2009-09-07 12:06] synchronizing package lists
    [2009-09-07 12:07] starting full system upgrade
    [2009-09-07 12:07] synchronizing package lists
    [2009-09-07 12:07] starting full system upgrade
    [2009-09-07 12:07] upgraded alsa-lib (1.0.20-1 -> 1.0.21-1)
    [2009-09-07 12:07] upgraded alsa-utils (1.0.20-2 -> 1.0.21-1)
    [2009-09-07 12:07] upgraded hdparm (9.21-1 -> 9.26-1)
    [2009-09-07 12:07] upgraded usbutils (0.84-1 -> 0.86-2)
    [2009-09-07 13:15] installed gedit-plugins (2.26.2-1)
    [2009-09-07 17:43] synchronizing package lists
    [2009-09-07 17:44] starting full system upgrade
    [2009-09-07 17:44] Install jack-audio-connection-kit, libsamplerate, ffmpeg
    [2009-09-07 17:44] or pulseaudio to get their respective plugins working
    [2009-09-07 17:44] upgraded alsa-plugins (1.0.20-1 -> 1.0.21-1)
    [2009-09-07 17:44] upgraded gnupg2 (2.0.12-1 -> 2.0.13-1)
    [2009-09-08 10:18] synchronizing package lists
    [2009-09-08 10:19] starting full system upgrade
    [2009-09-08 10:22] upgraded fftw (3.2.1-1 -> 3.2.2-1)
    [2009-09-08 10:22] upgraded fuse (2.7.4-3 -> 2.8.0-1)
    [2009-09-08 10:22] upgraded gparted (0.4.6-1 -> 0.4.6-2)
    Last edited by Polygon (2009-09-10 01:51:39)

    Do you happen to know what package broke this? I had this issue a couple weeks ago, and just recently it reappeared.

  • The screen on my macbook has malfunction. When I change the brightness to zero and return to the first level of brightness it works briefly but then the screen starts to flicker brightness and quickly extinguished.

    The screen on my macbook has malfunction. When I change the brightness to zero and return to the first level of brightness it works briefly but then the screen starts to flicker brightness and quickly extinguished. It seems to be a bad contact, it would not be normal for a quality product that should have, he has less than two years of use. Not because of the bad use or crash. Someone with the same problem or can help me? It's really a contact problem? I've done all the procedures recommended by the online support. Thanks.

    Hey everyone in Apple world!
    I figured out how to fix the flashing yellow screen problem that I've been having on my MBP!  Yessssss!!!
    I found this super handy website with the golden answer:
    I followed the instructions on this page and here's what I did:
    Resetting NVRAM / PRAM
    Shut down your Mac.
    Locate the following keys on the keyboard: Command (⌘), Option, P, and R. You will need to hold these keys down simultaneously in step 4.
    Turn on the computer.
    Press and hold the Command-Option-P-R keys before the gray screen appears.
    Hold the keys down until the computer restarts and you hear the startup sound for the second time.
    Release the keys.
    I went through the 6 steps above twice, just to make sure I got rid of whatever stuff was holding up my bootup process.  Since I did that, my MBP boots up just like normal.  No flashing yellow screen anymore!!   
    (Note that I arrived at this solution when I first saw this page:
    Let me know if this works for you!

Maybe you are looking for