From b9f8cdb8bc92d537822b977c3ff4a22497a490af Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Tue, 1 Jun 2021 17:38:05 +1000 Subject: [PATCH] try to fall back to xcb if wayland forced on packaged build https://forums.ankiweb.net/t/anki-doesnt-start-under-wayland-linux/10409/5 --- qt/aqt/__init__.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/qt/aqt/__init__.py b/qt/aqt/__init__.py index e6b07f940..3a3605c9c 100644 --- a/qt/aqt/__init__.py +++ b/qt/aqt/__init__.py @@ -461,6 +461,14 @@ def _run(argv: Optional[List[str]] = None, exec: bool = True) -> Optional[AnkiAp profiler = cProfile.Profile() profiler.enable() + if ( + isWin + and getattr(sys, "frozen", False) + and os.getenv("QT_QPA_PLATFORM") == "wayland" + ): + # the packaged builds currently do not support wayland natively + os.environ["QT_QPA_PLATFORM"] = "xcb" + # default to specified/system language before getting user's preference so that we can localize some more strings lang = anki.lang.get_def_lang(opts.lang) anki.lang.set_lang(lang[1])