SUMMARY Windows sometimes become invisible when switching virtual desktops or peeking the desktop. It happens relatively rarely and randomly, but often enough to be annoying. Until recently, I didn't know any workarounds. The only way to continue work was to either close and re-open the window, or migrate all tabs to a new window if the application supports tabs (I usually hit the bug either on Firefox or Konsole). I accidentally found that unloading the "windowaperture" effect in Kwin Debug Console makes the window visible again. I first noticed the bug at least two years ago. I have not reported it until today because I couldn't reliably reproduce it. I'm not sure if I encountered it when using X11, I currently use Wayland. STEPS TO REPRODUCE 1. Make sure windowaperture effect is loaded in in Kwin debug console. 2. Go to any window, hold "Peek at desktop" Window Management shortcut (I think Meta+D is the default) for ~2 minutes, usually 30 seconds is enough. EPILEPSY WARNING: the window and desktop may alternate very fast causing a strobe-like effect. OBSERVED RESULT The window should become invisible after some hide/unhide cycles. The window is still there, can be activated and interacted with, is visible in window switcher, overview etc... It's just invisible on the desktop, regardless of whether it's activated or not. Switching to it, or hitting Meta+D does not make it visible again. It can be made visible again by unloading the windowaperture effect in KWin debug console. Loading the effect after unloading it does not make the window invisible again (unless the steps from reproduce are repeated). EXPECTED RESULT The window should stay visible or become visible after quitting the "Peek desktop" state. SOFTWARE/OS VERSIONS Linux/KDE Plasma: Arch Linux, 6.15.4-arch2-1, last upgrade on 2025-07-05T14:28:06+0200 KDE Plasma Version: 6.4.2 (also reproducible on 6.1.3) KDE Frameworks Version: 6.15.0 (also reproducible on 6.4.0) Qt Version: 6.9.1 (also reproducible on 6.7.2) KWin Version: 6.4.2 (also reproducible in 6.1.3) ADDITIONAL INFORMATION I was able to reproduce the bug on fullscreen, maximized and unmaximized windows. Same with windows with and without hidden titlebar/frame. I don't have a taskbar or a topbar, windows are usually maximized. I only have the "Desktop Change OSD" KWin script activated. Activated desktop effects: Invert, Background contrast, Blur, Desaturate Unresponsive Applications, Dialog Parent, Dim Screen for Administrator Mode, Overview.
Do you see anything in kwin's logs? journalctl --boot -0 --user-unit plasma-kwin_wayland
(In reply to Vlad Zahorodnii from comment #1) > Do you see anything in kwin's logs? > > journalctl --boot -0 --user-unit plasma-kwin_wayland Yes, this message appears quite often when holding Meta+D, also around the time the window disappears (but not only then). ``` lip 10 13:07:28 trial kwin_wayland[2422]: "Could not convert argument 0 from undefined to QList<qulonglong>" lip 10 13:07:28 trial kwin_wayland[2422]: "animationEnded@:188" lip 10 13:07:28 trial kwin_wayland[2422]: <Unknown File>:188: TypeError: Passing incompatible arguments to C++ functions from JavaScript is not allowed. ```
This looks like a QJSEngine bug :( https://invent.kde.org/plasma/kwin/-/blob/b8e3426b49350e94ea0233fe6a4e9c73c74a3424/src/plugins/windowaperture/package/contents/code/main.js#L144 set() returns a proper value but `w.offToCornerId` is `undefined` after the assignment.
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/7899
(In reply to Vlad Zahorodnii from comment #3) > This looks like a QJSEngine bug :( > > https://invent.kde.org/plasma/kwin/-/blob/ > b8e3426b49350e94ea0233fe6a4e9c73c74a3424/src/plugins/windowaperture/package/ > contents/code/main.js#L144 set() returns a proper value but > `w.offToCornerId` is `undefined` after the assignment. (I don't know much about KDE internals so I'm not saying it's not a QJSEngine bug, but...) Are you sure? I added some logs where offToCornerId is set and deleted and I get traces like the following: > js: showing, set w.offToCornerId KWin::EffectWindow(0x5626eb88fb80) [73251,73252] > js: animation ended KWin::EffectWindow(0x5626eb88fb80) [73251,73252] > js: animation ended KWin::EffectWindow(0x5626eb88fb80) undefined > "Could not convert argument 0 from undefined to QList<qulonglong>" > "animationEnded@:192" > <Unknown File>:192: TypeError: Passing incompatible arguments to C++ functions from JavaScript is not allowed. Right before the TypeError there always are two consecutive "animation ended", the second always has undefined offToCornerId. "showing, set w.offToCornerId" never shows undefined offToCornerId (but I guess it could become undefined after the function exists...). I only get this message if I hold Meta+D (so I guess things must happen fast). Modified /usr/share/kwin-wayland/effects/windowaperture/contents/code/main.js: https://gist.github.com/fstachura/8af1e74b7698dd14b40fdcda1867711c
Yeah I'm pretty sure. That TypeError can occur when both animate() and set() animations finish, which is the linked MR fixes. But the problem is still that w.offToCornerId is undefined sometimes even though set() has returned a valid array object. QJSEngine used to have a similar issue in the past, https://codereview.qt-project.org/c/qt/qtdeclarative/+/376471, but in that case it did delete the wrapper for EffectWindow some time later when collecting garbage, so we saw that w.offToCornerId were valid after the assignment, but when it was time to show windows back, some offToCornerId's were gone.