fabric-makussu/bar/services/wlr/event_loop.py
2025-05-19 09:32:17 +02:00

22 lines
594 B
Python

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...")