Skip to content

Hadron/pydbus

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pydbus

Pythonic DBus library.

It's based on PyGI, the Python GObject Introspection bindings, which is the recommended way to use GLib from Python. Unfortunately, PyGI is not packaged on pypi, so you need to install it from your distribution's repository (usually called python-gi, python-gobject or pygobject3).

It's pythonic!

Examples

Send a desktop notification

from pydbus import SessionBus

bus = SessionBus()
notifications = bus.get('.Notifications')

notifications.Notify('test', 0, 'dialog-information', "Hello World!", "pydbus works :)", [], {}, 5000)

List systemd units

from pydbus import SystemBus

bus = SystemBus()
systemd = bus.get(".systemd1")

for unit in systemd.ListUnits()[0]:
    print(unit)

Watch for new systemd jobs

from pydbus import SystemBus
from gi.repository import GObject

bus = SystemBus()
systemd = bus.get(".systemd1")

systemd.JobNew.connect(print)
GObject.MainLoop().run()

# or

systemd.onJobNew = print
GObject.MainLoop().run()

Copyright Information

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

Releases

No releases published

Packages

No packages published

Languages

  • Python 81.2%
  • C++ 17.9%
  • Makefile 0.9%