From 9f9acb3528e970b7e0542cbd4ce128ade9b8db9a Mon Sep 17 00:00:00 2001 From: spaqin Date: Wed, 7 Aug 2024 08:42:07 +0200 Subject: [PATCH] gui: force xcb instead of wayland --- artiq/frontend/artiq_browser.py | 7 ++++++- artiq/frontend/artiq_dashboard.py | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/artiq/frontend/artiq_browser.py b/artiq/frontend/artiq_browser.py index c6c5d1b76..8016ee330 100755 --- a/artiq/frontend/artiq_browser.py +++ b/artiq/frontend/artiq_browser.py @@ -140,7 +140,12 @@ def main(): args.db_file = os.path.join(get_user_config_dir(), "artiq_browser.pyon") widget_log_handler = log.init_log(args, "browser") - app = QtWidgets.QApplication(["ARTIQ Browser"]) + forced_platform = [] + if (QtGui.QGuiApplication.platformName() == "wayland" and + not os.getenv("QT_QPA_PLATFORM")): + # force XCB instead of Wayland due to applets not embedding + forced_platform = ["-platform", "xcb"] + app = QtWidgets.QApplication(["ARTIQ Browser"] + forced_platform) loop = QEventLoop(app) asyncio.set_event_loop(loop) atexit.register(loop.close) diff --git a/artiq/frontend/artiq_dashboard.py b/artiq/frontend/artiq_dashboard.py index 8eff206a6..495c66c80 100755 --- a/artiq/frontend/artiq_dashboard.py +++ b/artiq/frontend/artiq_dashboard.py @@ -133,7 +133,12 @@ def main(): server=args.server.replace(":", "."), port=args.port_notify)) - app = QtWidgets.QApplication(["ARTIQ Dashboard"]) + forced_platform = [] + if (QtGui.QGuiApplication.platformName() == "wayland" and + not os.getenv("QT_QPA_PLATFORM")): + # force XCB instead of Wayland due to applets not embedding + forced_platform = ["-platform", "xcb"] + app = QtWidgets.QApplication(["ARTIQ Dashboard"] + forced_platform) loop = QEventLoop(app) asyncio.set_event_loop(loop) atexit.register(loop.close)