-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wayland issues #1767
Comments
Qt 5/6.2.2: fullscreen mode renders Anki transparent (confirmed on 2.1.51 RC2, Manjaro Gnome) |
Re 0b03919: on Qt 6.3 the warning about window.raise() doesn't pop up in the console anymore, but pressing The transparency issue for Gnome on fullscreen still occurs on 6.3. |
Thanks for testing. It changes focus for me when testing with Sway, so I suspect Mutter hasn't implemented the extension yet - if you have access to KDE to test with, maybe that would fare better? |
Sadly I don't have immediate access to KDE anymore, because I switched back to Gnome recently (smoother UX)... |
Qt 5/6.2.2/6.3: client side decorations are not supported, so when used on Gnome/Mutter, there are no borders/titlebars Also the sub-windows opens in top left corner instead of Center (like add tags to multiple cards, custom study, ...) https://www.reddit.com/r/Anki/comments/tzpouv/anki_250_window_frame_on_linux/ |
I'm on nixos using sway. I just tried going from current stable (21.11) which points to anki 2.1.49 to unstable which currently points to 2.1.51. The former seems to open fine, but the latter has mostly windows that are blank for me. This renders the new version of Anki completely unusable for me. I have an old Manjaro laptop which also has sway on it. I updated and tried to open Anki and get the exact same thing. When starting from a shell I get:
Let me know if I should open an entirely new issue or not. |
I just confirmed that whatever changes were made in the 2.1.52 release from today makes it display things again for me in sway: senorsmile/nixpkgs@7b33d2c. |
Anki 2.1.52 appears to have a regression since 2.1.50 on Flatpak (Fedora 35):
The application runs, but without scaling (this is expected according to this issue).
I tried downgrading Anki to 2.1.50:
The debug info from the working 2.1.50:
On 2.1.50, the application displays perfectly without these bugs. I suspect a bug in the code that blocks Wayland support, as it is apparently not used on my system anyway. |
That appears to be an issue with the Flatpak, not Anki. |
At any rate, with Ubuntu Jammy, under Sway, I can see borders and title bars perfectly fine, with ANKI_WAYLAND set to 1, as well as go fullscreen without any transparency. |
I'm using Anki on Fedora 38 (currently Beta) and Gnome through flatpak. Anki Version 2.1.60 (76d8807) Anki runs fine with basic non-gnome window decorations using:
I'm not sure what's providing the window decorations, maybe it's some QT fallback. |
Starting with version 2.1.62 which updated to Qt 6.5, support for fractional scaling got worse on my machine. Everything that is rendered inside a webview looks fuzzy while the menu bar and the client side decorations look fine (except of a thin transparent line). Additionally, many views are shown too small, but get back to the right size after resizing the window. I suspect this is because Qt 6.5 introduced support for fractional_scale_v1 and I'm using GNOME 44 which also supports this new protocol. I couldn't find any information whether Qt WebEngine supports fractional_scale_v1 at all, there is only this section about HiDPI support in general. OS: Fedora 38 Upstream bug report: https://bugreports.qt.io/browse/QTBUG-113574 |
I'm afraid I don't have GNOME on my system. Please reproduce this outside of Anki, then report the issue to the Qt developers. You can run the sample app below with the following commands: % python3 -m venv venv
% ./venv/bin/pip install pyqt6 pyqt6-webengine
% ./venv/bin/python test.py import sys
from PyQt6.QtCore import QUrl
from PyQt6.QtWidgets import QApplication
from PyQt6.QtWebEngineWidgets import QWebEngineView
class HelloWorldWebView(QWebEngineView):
def __init__(self):
super().__init__()
html = '''
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Hello World</title>
</head>
<body>
<h1>Hello World</h1>
</body>
</html>
'''
self.setHtml(html)
self.show()
if __name__ == '__main__':
app = QApplication(sys.argv)
web_view = HelloWorldWebView()
sys.exit(app.exec()) You can report the bug on https://bugreports.qt.io/. It would be great if you could provide a link to it here. |
I was able to reproduce the problem using a similar test script on both GNOME and KDE, so I created a bug report upstream at https://bugreports.qt.io/browse/QTBUG-113574. Thank you for the advice! |
Thanks for that. Someone's posted a workaround on that issue which can be used for now, and the next Anki update should apply it automatically on startup. |
Hello, using Flatpak version of Anki, 2.1.63 under Sway. Please let me know if any other details are needed, or if this was already reproduced in some other issue, I didn't manage to find any. |
Exporting works fine for me with Sway+Wayland. If this issue is specific to the Flatpak, please report it to the Flatpak author. |
Seems like that's the case indeed, tested it with installation from the website, that one functions properly. Thanks for checking. |
The workaround broke rendering for non-Wayland users. On Kubuntu with 150% scaling, after an upgrade to Anki 2.1.64, menus started looking like this (other parts of the interface got enlarged too): Commenting out if is_lin and qtmajor > 5:
os.environ["QT_SCALE_FACTOR_ROUNDING_POLICY"] = "RoundPreferFloor" Is there a way to limit the workaround only to Wayland? |
Sigh, that's unfortunate. I'll limit the env change to the Wayland path in the next update to resolve this. |
I tried the official package, and it cannot find the wayland qt window decorations provided by my distro (fedora 39), nor my themes (only Windows and Fusion):
|
The official package bundles its own version of Qt, so it won't be able to use your system Qt plugins. For that, you'd need to use your system Python and run Anki from the PyPi wheels instead. |
Could support for window decorations be implemented in anki's official package? |
Sorry, this is not an area I'm familiar with. I don't know whether it would require a patched Qt (not practical), or whether it could be done with a style plugin (and whether such a plugin would work across distros or not). |
Ok. Thank you. |
I'm still bumping into this with 2.1.66, however setting |
Apologies for reviving this thread but I appear to be having similar issues with Wayland. Anki 23.12 (97f43fb) (src)
Not quite sure if this is a RPi issue or a Qt one. |
I have the same problem as d-k-bo above. Arch/Gnome 45.2/Wayland/Fractional Scaling (125%). I had installed this AUR package https://aur.archlinux.org/packages/anki-bin . This makes the app unusable for me. |
The workaround |
Hi. On my machine, Anki crashes at random when closing a window. It does not occur without Wayland, and this issue doesn’t list it. Observed this on both a build from the instructions to build Anki from source and the Linux Qt6 release with My machine runs Arch Linux. I updated the system and restarted my compositor today. This is how I built and ran the Git version. $ git clone --depth=1 https://github.com/ankitects/anki.git
$ cd anki
$ ./run App starts. Click "Stats" button and close the window over and over again. Each time, Wayland prints warnings related to the event queue. After a few times, it crashes. Below is the terminal output with all the HTTP logs stripped. Preparing to run...
Serving on http://127.0.0.1:40000
DevTools listening on ws://127.0.0.1:8080/devtools/browser/c851ef13-2a95-474b-a25b-9d25460e3775
Qt debug: doh set to "" -- SystemOnly
Starting main loop...
Qt warning: Remote debugging server started successfully. Try pointing a Chromium-based browser to http://127.0.0.1:8080
blocked main thread for 536ms:
File "/home/user/code/anki/tools/run.py", line 14, in <module>
aqt.run()
File "/home/user/code/anki/qt/aqt/__init__.py", line 509, in run
_run()
File "/home/user/code/anki/qt/aqt/__init__.py", line 717, in _run
app.exec()
File "/home/user/code/anki/qt/aqt/progress.py", line 118, in handler
func()
File "/home/user/code/anki/qt/aqt/main.py", line 218, in on_window_init
fn()
File "/home/user/code/anki/qt/aqt/main.py", line 317, in setupProfile
self.loadProfile()
File "/home/user/code/anki/qt/aqt/main.py", line 474, in loadProfile
if not self.loadCollection():
File "/home/user/code/anki/qt/aqt/main.py", line 610, in loadCollection
self._loadCollection()
File "/home/user/code/anki/qt/aqt/main.py", line 646, in _loadCollection
self.col = Collection(cpath, backend=self.backend)
File "/home/user/code/anki/pylib/anki/collection.py", line 150, in __init__
self.reopen()
File "/home/user/code/anki/pylib/anki/collection.py", line 291, in reopen
self._backend.open_collection(
File "/home/user/code/anki/out/pylib/anki/_backend_generated.py", line 133, in open_collection
raw_bytes = self._run_command(3, 0, message.SerializeToString())
File "/home/user/code/anki/pylib/anki/_backend.py", line 162, in _run_command
print("".join(traceback.format_stack()))
Traceback (most recent call last):
File "/home/user/code/anki/qt/aqt/sound.py", line 854, in setup_audio
mpvManager = MpvManager(base_folder, media_folder)
File "/home/user/code/anki/qt/aqt/sound.py", line 408, in __init__
super().__init__(window_id=None, debug=False)
File "/home/user/code/anki/qt/aqt/mpv.py", line 441, in __init__
super().__init__(*args, **kwargs)
File "/home/user/code/anki/qt/aqt/mpv.py", line 103, in __init__
self._start_socket()
File "/home/user/code/anki/qt/aqt/mpv.py", line 193, in _start_socket
raise MPVProcessError("unable to start process")
aqt.mpv.MPVProcessError: unable to start process
mpv too old or failed to open, reverting to mplayer
warning: queue 0x25d0bb0 destroyed while proxies still attached:
wl_callback@75 still attached
wl_buffer@80 still attached
wl_buffer@78 still attached
wl_buffer@76 still attached
wl_buffer@73 still attached
warning: queue 0x2524410 destroyed while proxies still attached:
wl_callback@91 still attached
wl_buffer@90 still attached
wl_buffer@88 still attached
wl_buffer@86 still attached
wl_buffer@83 still attached
warning: queue 0x2551860 destroyed while proxies still attached:
wl_callback@97 still attached
wl_buffer@98 still attached
wl_buffer@96 still attached
wl_buffer@94 still attached
wl_buffer@85 still attached
Tried to add event to destroyed queue
./run: line 19: 244442 Aborted (core dumped) ./out/pyenv/bin/python tools/run.py $* Running (gdb) bt
#0 __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at pthread_kill.c:44
#1 0x00007f22d3dbf8a3 in __pthread_kill_internal (signo=6, threadid=<optimized out>) at pthread_kill.c:78
#2 0x00007f22d3d6f668 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#3 0x00007f22d3d574b8 in __GI_abort () at abort.c:79
#4 0x00007f22c9e754f2 in wl_abort (fmt=fmt@entry=0x7f22c9e7a6d8 "Tried to add event to destroyed queue\n") at ../wayland-1.22.0/src/wayland-util.c:462
#5 0x00007f22c9e777e2 in queue_event (len=<optimized out>, display=0xde9830) at ../wayland-1.22.0/src/wayland-client.c:1575
#6 read_events (display=0xde9830) at ../wayland-1.22.0/src/wayland-client.c:1670
#7 wl_display_read_events (display=0xde9830) at ../wayland-1.22.0/src/wayland-client.c:1753
#8 0x00007f22bd2dfe6c in () at /home/user/code/anki/out/pyenv/lib/python3.9/site-packages/PyQt6/Qt6/plugins/platforms/../../lib/libQt6WaylandClient.so.6
#9 0x00007f22ceef29dd in () at /home/user/code/anki/out/pyenv/lib/python3.9/site-packages/PyQt6/Qt6/lib/libQt6Core.so.6
#10 0x00007f22d3dbd9eb in start_thread (arg=<optimized out>) at pthread_create.c:444
#11 0x00007f22d3e417cc in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78 On the release, the Python warnings and stack traces, the HTTP logs and the mpv warning don’t print. But the part about Wayland event queues do, and the same crash occurs. On a side note, is there any reason why Git builds enable Wayland by default while releases don’t? Of course, let me know if this needs its own issue. |
This is handled by Qt, so not something we can fix directly. It doesn't seem to happen on my system (using Sway as a WM).
Developers are more likely to see the console output, and being using Wayland. |
Is there any reference on how to do this? |
I saw, but I couldn't get a binary executable without aqt. |
Chromebook specific issue:
Affects Flatpak build: flathub/net.ankiweb.Anki#135 Reported on forums: https://forums.ankiweb.net/t/cant-download-anki-on-terminal-linux/41563/18 Chromebook Wayland protocol: Sommelier Alternative: Making an Anki package in https://github.com/chromebrew/chromebrew and document for CB users |
@NameLessGO I'm not sure that's a Chromebook issue. I develop another PyQt5 app (https://github.com/FreeLanguageTools/vocabsieve) and I've seen this sometimes on Wayland on Linux. I think this usually happens when there is a blocking operation. |
The window decorations and theming issues seem to span other pyqt5 and pyqt6 apps as well. I checked the library files in pyenv and found the system installed themes are just not installed. Adding the .so file for the libadwaita qt decorations to the folder in py-qt with the libbradient (default qt) decorations caused the app to launch without decorations. The bottom line is, I think this is upstream, but it could be fixed or at least mitigated in aqt by adding in the window decorations that align with gnome, plasma and other common DE's default themes. |
Window decoration is ugly in GNOME because GNOME refuses to do server-side decoration on Wayland so it falls back to the default one from Qt6. The Qt5 version doesn't show this because Qt5 defaults to run under X11 on GNOME. On environments that support SSD (KDE plasma, etc) this all works as expected. A fix from Anki would probably be a basic GNOME-themed CSD, which should not be shown on environments that can do SSD so it doesn't look bad on Plasma/Sway/Hyprland. |
This occurs regardless of qt5 or qt6. The libbradient decorations appear on wayland and cannot be replaced. If I manually add libadwaita decorations to the library folder for pyqt5 or qt6 from my system's qt5 and qt6 libraries, it causes the decorations to disappear completely. The basic CSD is exactly what I'd recommend, specifically QAdwaitaDecorations and QGnomePlatform. If the libraries are built correctly, they should apply just like libbradient seeing as the env variable is set by default on some distros or can be set by users and is read by anki. However, I understand if anki doesn't try this, as this is really a PyQT issue. Do you know if PyQT is typically able to use user themes? Both themes and wayland decorations function as QT plugins, so I assume it's the same system. |
By default Qt5 wouldn't use Wayland on GNOME, unless you have QT_QPA_PLATFORM=wayland. With a qt6 distro package it still uses the default (non interactive, thin) window titlebar and no shadow. The current theming tools like qt6ct seems to not have no direct way of handling this. PyQt or PySide is no different from Qt and can use system themes if it is linked to your system Qt library (distro packages of Anki or pip), but not if statically linked (such as official Anki builds). I have a PyQt5 application (https://github.com/FreeLanguageTools/vocabsieve), and it is able to use Qt themes when installed normally systemwide, but not in an appimage or virtualenv. Honestly GNOME is the one who should be fixing this by adding SSD or someone should make a patch for it. Having builtin CSD is going to look non-native most of the times and will stand out on a GNOME system. Libadwaita actually have themable colors and if Anki assumes the default scheme, it will look out of place again. It can't be that difficult to do since it works on Xwayland windows just fine. |
On Ubuntu 22.04, a manual install appears to work ok with the environment variable set but crashes on syncing. However, the flatpack version seems to work fine. |
I still can't fix my issues with the official download or pywheels, but I partially fixed it with the unofficial flatpak. If I use --runtime=org.kde.Platform/x86_64/6.6, wayland window decorations work. However, this does not fix the cursor issue (which affects non-python qt apps) and the theme. In fact, it's even weirder. Now, the warning reads:
This is weird because only Windows and Fusion still work; the others are now shown as available but are warned as an invalid override. I can't find anything online where the top error occurred but the invalid style was in the available styles. |
I was able to get Anki to crash when trying to login to sync. I was about to post a new issue, but saw this one. After switching to using XWayland, it did not crash. Here's the crash log I had:
System: EndeavorOS, Linux 6.8.7-zen |
This issue still valid. |
Gnome 43, local build of Anki: Everything works fine, except for smaller things like decorations as already mentioned. Then there's also some UI lag here and there, not sure what to make of it but I do honestly find Anki usable in this state. |
I have the same issue, tried it in Gnome and Hyprland. System: Nixos 24.05 |
https://forums.ankiweb.net/t/blury-interface-with-gnome-wayland-and-fractional-scaling/19196/3?u=kleinerpirat
Anki will link users to this page when they run Anki on a Wayland system.
The text was updated successfully, but these errors were encountered: