from fabric.core.service import Service, Property from pywayland.client import Display from gi.repository import GLib class WaylandEventLoopService(Service): @Property(object, "readable", "display") def display_property(self): return self._display def __init__(self, **kwargs): super().__init__(**kwargs) self._display = Display() self._display.connect() self.thread = GLib.Thread.new("wayland-loop", self._loop) def _loop(self): while True: self._display.dispatch(block=True) print("DISPATCHING...")