baumi's blog

baumi's personal blog … Linux, OS X, Windows, Random things, …

GNU/Linux Elementary OS “Freya”: custom brightness indicator, exponential brightness control

brightness

http://ubuntuhandbook.org/index.php/2013/09/add-brightness-control-elementary-os/

this works nicely, however my personal taste is to have more precise control over low brightness settings. therefore i’ve adjusted the script to do exponential brightness. the two changed functions are in /opt/extras.ubuntu.com/indicator-brightness/indicator-brightness, changes in bold:

def set_brightness(brightness):
    bbb = int(brightness) * int(brightness) / max_brightness
    subprocess.call(['pkexec','/usr/lib/gnome-settings-daemon/gsd-backlight-helper','--set-brightness',"%s" % bbb])
    create_menu(ind)

 

def get_curr_brightness():
    c = 0
    try:
        p = subprocess.Popen(['pkexec','/usr/lib/gnome-settings-daemon/gsd-backlight-helper','--get-brightness'], stdout=subprocess.PIPE)
        curr_brightness = float(p.communicate()[0])
        curr_brightness = int( ((curr_brightness/max_brightness)**0.5) * max_brightness)
        c = closest(curr_brightness, brightness_settings)
    except:
        c = 0
    return brightness_settings.index(c)

Comments are currently closed.