Fallback to Wayland if X11 is not available (#2433)

* Fallback to Wayland if X11 is not available

* Avoid saying "support is disabled" when falling back to Wayland (dae)
This commit is contained in:
Ingemar Berg 2023-03-15 06:11:33 +01:00 committed by GitHub
parent f5eda9008f
commit 5afbf8934f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 5 deletions

View file

@ -115,6 +115,7 @@ Tobias Predel <tobias.predel@gmail.com>
Daniel Tang <danielzgtg.opensource@gmail.com>
Jack Pearson <github.com/jrpear>
yellowjello <github.com/yellowjello>
Ingemar Berg <github.com/ingemarberg>
********************

View file

@ -532,11 +532,17 @@ def _run(argv: Optional[list[str]] = None, exec: bool = True) -> Optional[AnkiAp
and (os.getenv("QT_QPA_PLATFORM") == "wayland" or os.getenv("WAYLAND_DISPLAY"))
and not os.getenv("ANKI_WAYLAND")
):
# users need to opt in to wayland support, given the issues it has
print("Wayland support is disabled by default due to bugs:")
print("https://github.com/ankitects/anki/issues/1767")
print("You can force it on with an env var: ANKI_WAYLAND=1")
os.environ["QT_QPA_PLATFORM"] = "xcb"
if not os.getenv("DISPLAY"):
print(
"Trying to use X11, but it is not available. Falling back to Wayland, which has some bugs:"
)
print("https://github.com/ankitects/anki/issues/1767")
else:
# users need to opt in to wayland support, given the issues it has
print("Wayland support is disabled by default due to bugs:")
print("https://github.com/ankitects/anki/issues/1767")
print("You can force it on with an env var: ANKI_WAYLAND=1")
os.environ["QT_QPA_PLATFORM"] = "xcb"
# profile manager
i18n_setup = False