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
This commit is contained in:
Damien Elmes 2021-06-01 17:38:05 +10:00
parent 595e23189b
commit b9f8cdb8bc

View File

@ -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])