diff --git a/debian/control b/debian/control index 54980d1..c9c11ed 100644 --- a/debian/control +++ b/debian/control @@ -6,7 +6,7 @@ Build-Depends: debhelper (>= 9), dh-python, python3-all, - python3-gbulb, + python3-gi (>= 3.50.0) | python3-gbulb, python3-setuptools, python3-systemd, python3-qubesadmin, diff --git a/qubes_menu/appmenu.py b/qubes_menu/appmenu.py index f7102ca..ddccd88 100644 --- a/qubes_menu/appmenu.py +++ b/qubes_menu/appmenu.py @@ -31,8 +31,14 @@ gi.require_version('GtkLayerShell', '0.1') from gi.repository import Gtk, Gdk, GLib, Gio, GtkLayerShell -import gbulb -gbulb.install() +try: + from gi.events import GLibEventLoopPolicy + asyncio.set_event_loop_policy(GLibEventLoopPolicy()) + HAS_GBULB = False +except ImportError: + import gbulb + gbulb.install() + HAS_GBULB = True PAGE_LIST = [ "search_page", "app_page", "favorites_page", "settings_page" @@ -303,13 +309,9 @@ def do_activate(self, *args, **kwargs): # navigation works self.handlers[self.initial_page].page_widget.grab_focus() - loop = asyncio.get_event_loop() self.tasks = [ asyncio.ensure_future(self.dispatcher.listen_for_events()), ] - - loop.run_until_complete(asyncio.wait( - self.tasks, return_when=asyncio.FIRST_EXCEPTION)) else: if self.main_notebook: self.main_notebook.set_current_page( @@ -548,7 +550,11 @@ def main(): qapp = qubesadmin.Qubes() dispatcher = qubesadmin.events.EventsDispatcher(qapp) app = AppMenu(qapp, dispatcher) - app.run(sys.argv) + if HAS_GBULB: + loop: gbulb.GLibEventLoop = asyncio.get_event_loop() + loop.run_forever(application=app, argv=sys.argv) + else: + app.run(sys.argv) if __name__ == '__main__': diff --git a/rpm_spec/qubes-desktop-linux-menu.spec.in b/rpm_spec/qubes-desktop-linux-menu.spec.in index d794d2c..8e7d896 100644 --- a/rpm_spec/qubes-desktop-linux-menu.spec.in +++ b/rpm_spec/qubes-desktop-linux-menu.spec.in @@ -47,7 +47,11 @@ BuildRequires: python%{python3_pkgversion}-setuptools BuildRequires: gettext Requires: python%{python3_pkgversion}-setuptools +%if 0%{?fedora} < 42 Requires: python%{python3_pkgversion}-gbulb +%else +Requires: python%{python3_pkgversion}-gobject >= 3.50.0 +%endif Requires: gtk3 Requires: gtk-layer-shell Requires: python%{python3_pkgversion}-qubesadmin >= 4.1.8