SHARE
TWEET

Untitled

a guest Mar 20th, 2019 66 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. '''Cycles keyboard brightness levels using DBus.'''
  2. import dbus
  3.  
  4. def main():
  5.     bus = dbus.SystemBus()
  6.     proxy = bus.get_object('org.freedesktop.UPower',
  7.                            '/org/freedesktop/UPower/KbdBacklight')
  8.     interface = dbus.Interface(proxy, 'org.freedesktop.UPower.KbdBacklight')
  9.  
  10.     current_level = interface.GetBrightness()
  11.     max_level = interface.GetMaxBrightness()
  12.  
  13.     interface.SetBrightness((current_level+1) % (max_level+1))
  14.  
  15. if __name__ == "__main__":
  16.     main()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top