Skip to content

Instantly share code, notes, and snippets.

@rbrito
Created February 11, 2013 07:44
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save rbrito/4753151 to your computer and use it in GitHub Desktop.
Save rbrito/4753151 to your computer and use it in GitHub Desktop.
Script to control monitor brightness
#!/usr/bin/env python
"""
Python script to essentially perform the same as:
gdbus call \
--session \
--dest org.gnome.SettingsDaemon \
--object-path /org/gnome/SettingsDaemon/Power \
--method org.gnome.SettingsDaemon.Power.Screen.SetPercentage 75
References:
http://ask.fedoraproject.org/question/980/brightness-applet-on-gnome-panel
http://en.wikibooks.org/wiki/Python_Programming/Dbus
http://www.devtech.com/inhibitapplet
"""
if __name__ == '__main__':
import dbus
session_bus = dbus.SessionBus()
proxy = session_bus.get_object("org.gnome.SettingsDaemon",
"/org/gnome/SettingsDaemon/Power")
dbus_int = dbus.Interface(proxy, "org.gnome.SettingsDaemon.Power.Screen")
set_percentage = dbus_int.get_dbus_method("SetPercentage")
set_percentage(40)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment