Skip to content

Instantly share code, notes, and snippets.

@jrosco
Last active August 29, 2015 14:13
Show Gist options
  • Select an option

  • Save jrosco/938501c91c476805808f to your computer and use it in GitHub Desktop.

Select an option

Save jrosco/938501c91c476805808f to your computer and use it in GitHub Desktop.
DBus Notifcation Popup
#!/usr/bin/env python
import dbus
def notify(summary, body='', app_name='', app_icon='',
timeout=5000, actions=[], hints=[], replaces_id=0):
bus_name = 'org.freedesktop.Notifications'
object_path = '/org/freedesktop/Notifications'
interface_name = bus_name
session_bus = dbus.SessionBus()
obj = session_bus.get_object(bus_name, object_path)
interface = dbus.Interface(obj, interface_name)
interface.Notify(app_name, replaces_id, app_icon, summary, body, actions, hints, timeout)
# If run as a script, just display the argv as summary
if __name__ == '__main__':
notify(summary='linux-gravatar', body='Added new avatar')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment