/dbus_send_python.py Secret
Last active
June 30, 2016 01:26
-
-
Save teward/52a7f58ec94a1e3652831ebf95418912 to your computer and use it in GitHub Desktop.
python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import dbus | |
def get_dbus(obj, path, interface, method): | |
# This basically works the same as | |
# dbus-send or qdbus. Just give it | |
# all the info, and it will spit out output | |
bus = dbus.SessionBus() | |
proxy = bus.get_object(obj, path) | |
method = proxy.get_dbus_method(method, interface) | |
return method() | |
windows = get_dbus('org.ayatana.bamf', '/org/ayatana/bamf/matcher', 'org.ayatana.bamf.matcher', 'WindowPaths') | |
for window in windows: | |
print get_dbus('org.ayatana.bamf', window, 'org.ayatana.bamf.view', 'Name') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Style is important, all must obey PEP8! Jon Skeet endorses PEP8 you know!
PEP8: https://www.python.org/dev/peps/pep-0008/