Skip to content

Instantly share code, notes, and snippets.

@edrex
Created September 29, 2010 07:04
Show Gist options
  • Save edrex/602388 to your computer and use it in GitHub Desktop.
Save edrex/602388 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
# quickly toggle between brightness levels
# put this in your path and run it using a gnome keyboard shortcut
# i have it bound to Ctrl-F5
import dbus
bus=dbus.SessionBus()
proxy=bus.get_object('org.gnome.PowerManager','/org/gnome/PowerManager/Backlight')
cl = int(proxy.GetBrightness(dbus_interface='org.gnome.PowerManager.Backlight'))
if cl < 20:
nl = 30L
elif cl < 90:
nl = 100L
else:
nl = 1L
proxy.SetBrightness(dbus.UInt32(nl), dbus_interface='org.gnome.PowerManager.Backlight')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment