Skip to content

Instantly share code, notes, and snippets.

@sandorex
Last active July 8, 2024 10:53
Show Gist options
  • Save sandorex/c5f585992f0b087c94ff4942e8771df5 to your computer and use it in GitHub Desktop.
Save sandorex/c5f585992f0b087c94ff4942e8771df5 to your computer and use it in GitHub Desktop.
Minimal example to subscribe to settings change in xdg-.desktop-portal
#!/usr/bin/env python3
from dasbus.connection import SessionMessageBus, SystemMessageBus
from dasbus.loop import EventLoop
bus = SessionMessageBus()
loop = EventLoop()
proxy = bus.get_proxy(
"org.freedesktop.portal.Desktop", # service
"/org/freedesktop/portal/desktop", # obj path
"org.freedesktop.portal.Settings", # interface
)
def callback(*args):
print("The notification: ", *args)
proxy.SettingChanged.connect(callback)
loop.run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment