Bug 479552 - Cover Switch and Flip switch preview buttons don't work
Summary: Cover Switch and Flip switch preview buttons don't work
Status: RESOLVED FIXED
Alias: None
Product: systemsettings
Classification: Applications
Component: kcm_kwintabbox (show other bugs)
Version: 5.91.0
Platform: Neon Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords: qt6
Depends on:
Blocks:
 
Reported: 2024-01-08 21:46 UTC by iodreamify
Modified: 2024-01-13 15:07 UTC (History)
6 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.93.0
Sentry Crash Report:


Attachments
Task switcher previews piling up (1.72 MB, image/png)
2024-01-08 22:56 UTC, Doug
Details

Note You need to log in before you can comment on or make changes to this bug.
Description iodreamify 2024-01-08 21:46:29 UTC
SUMMARY
The preview buttons for the Cover Switch and Flip switch alt-tab boxes don't work. 

Logs indicate: 
Jan 08 21:08:36 neon systemsettings[9440]: "file:///usr/share/kwin/tabbox/coverswitch/contents/ui/main.qml:42 KWin.DesktopBackground is not a type\n"
Jan 08 21:08:36 neon systemsettings[9440]: QQmlComponent: Component is not ready
Jan 08 21:44:53 neon systemsettings[11870]: "file:///usr/share/kwin/tabbox/flipswitch/contents/ui/main.qml:42 KWin.DesktopBackground is not a type\n"
Jan 08 21:44:53 neon systemsettings[11870]: QQmlComponent: Component is not ready

STEPS TO REPRODUCE
1. Select Cover Switch or Flip Switch in systemsetting's Task Switcher section
2. Press the preview button

OBSERVED RESULT
Nothing happens

EXPECTED RESULT
Previews work like with the rest of the task switchers

Operating System: KDE neon Unstable Edition
KDE Plasma Version: 5.91.90
KDE Frameworks Version: 5.248.0
Qt Version: 6.6.1
Kernel Version: 6.2.0-39-generic (64-bit)
Graphics Platform: Wayland
Graphics Processor: Mesa Intel® HD Graphics 3000
Comment 1 Doug 2024-01-08 22:56:21 UTC
Created attachment 164765 [details]
Task switcher previews piling up

Can reproduce.  Also, task switcher previews don't go away, even after exiting System Settings.  Should I submit a separate bug for that?
Comment 2 iodreamify 2024-01-08 23:03:29 UTC
(In reply to Doug from comment #1)
> Created attachment 164765 [details]
> Task switcher previews piling up
> 
> Can reproduce.  Also, task switcher previews don't go away, even after
> exiting System Settings.  Should I submit a separate bug for that?

Feel free to do so, I also see this behavior. The only reason i didn't report it was because i saw similar reports from years ago.

https://bugs.kde.org/show_bug.cgi?id=462076
https://bugs.kde.org/show_bug.cgi?id=374971

But perhaps they're not fully related and the situation with wayland has changed a lot since then.
Comment 3 Doug 2024-01-08 23:12:54 UTC
(In reply to iodreamify from comment #2)
> (In reply to Doug from comment #1)
> > Created attachment 164765 [details]
> > Task switcher previews piling up
> > 
> > Can reproduce.  Also, task switcher previews don't go away, even after
> > exiting System Settings.  Should I submit a separate bug for that?
> 
> Feel free to do so, I also see this behavior. The only reason i didn't
> report it was because i saw similar reports from years ago.
> 
> https://bugs.kde.org/show_bug.cgi?id=462076
> https://bugs.kde.org/show_bug.cgi?id=374971
> 
> But perhaps they're not fully related and the situation with wayland has
> changed a lot since then.

OK, I updated both of those to note that they are still problems in Plasma 6 Beta 2
Comment 4 Ismael Asensio 2024-01-08 23:32:31 UTC
Can confirm too. Thanks for submitting! 

This is happening on Plasma5 too. The preview code mocks up `TabBoxSwitcher` and `Thumbnail` items, without using the actual tabbox code or linking to kwin, so it cannot access the KWin plugin that provides the background.  This is enough for simpler switchers but fails for those who access specific KWin API.

I cannot think of a simple fix. A proper one would require some refactoring:
- Plasma provides the background as part of a `FullScreenPlasmaWindow` component.
- We refactor the tabbox code into a small individual library, so it's kwin who provides a "fake" model but actual items for the preview (larger scope, but might be part on something I've been planning to do eventually).
- Also mocking-up the DesktopBackground component, using a "fake" one, (but it may fail for other 3rd party switchers which rely on different KWin API that is not mocked up)

(In reply to Doug from comment #1)
> Created attachment 164765 [details]
> Task switcher previews piling up
> 
> Can reproduce.  Also, task switcher previews don't go away, even after
> exiting System Settings.  Should I submit a separate bug for that?

Yes please, that's a different issue and it helps keeping thinks separated.
Comment 5 Doug 2024-01-08 23:42:08 UTC
(In reply to Ismael Asensio from comment #4)
> Can confirm too. Thanks for submitting! 
> 
> This is happening on Plasma5 too. The preview code mocks up `TabBoxSwitcher`
> and `Thumbnail` items, without using the actual tabbox code or linking to
> kwin, so it cannot access the KWin plugin that provides the background. 
> This is enough for simpler switchers but fails for those who access specific
> KWin API.
> 
> I cannot think of a simple fix. A proper one would require some refactoring:
> - Plasma provides the background as part of a `FullScreenPlasmaWindow`
> component.
> - We refactor the tabbox code into a small individual library, so it's kwin
> who provides a "fake" model but actual items for the preview (larger scope,
> but might be part on something I've been planning to do eventually).
> - Also mocking-up the DesktopBackground component, using a "fake" one, (but
> it may fail for other 3rd party switchers which rely on different KWin API
> that is not mocked up)
> 
> (In reply to Doug from comment #1)
> > Created attachment 164765 [details]
> > Task switcher previews piling up
> > 
> > Can reproduce.  Also, task switcher previews don't go away, even after
> > exiting System Settings.  Should I submit a separate bug for that?
> 
> Yes please, that's a different issue and it helps keeping thinks separated.

Could the preview button just bring up a simple image or animated clip, without referencing the actual windows from the user's session?  Could be a screenshot or short clip, or something more diagrammatic like the Panel Settings popup.   I would think that people just need to see what is meant by "Cover Switch" or "Flip Switch" to know if they want to try it out.
Comment 6 Ismael Asensio 2024-01-09 00:27:11 UTC
> Could the preview button just bring up a simple image or animated clip,
> without referencing the actual windows from the user's session? 

Oh, this is what we are doing right now. :) We're constructing an animation but using the actual effect code (which is helpful also for other 3rd party switchers), but not the real windows nor thumbnails. 

The fact that it looks like the actual windows means it is a nice trick.  :D 

>> Could be a screenshot or short clip

This is not a bad idea at all. It could simplify things, specially in the future. This means also some important changes. 
Unfortunately this KCM's code is getting a bit old and adding clips/screenshots is not as easy as in the newer ones.
Comment 7 Bug Janitor Service 2024-01-13 01:20:17 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/4910
Comment 8 Ismael Asensio 2024-01-13 15:01:28 UTC
Git commit 3572e6f0e773eb82008b6799faac8278e009ae5a by Ismael Asensio.
Committed on 13/01/2024 at 15:26.
Pushed by iasensio into branch 'master'.

kcms/tabbox: Add mock-up object for KWin.DesktopBackground

The window switcher previews don't use the actual quick components
the KWin plugin provides, but mock-up objects of those.

Add a mock-up component for `KWin.DesktopBackground`, which is just
a thumbnail of the desktop default image but stretched to cover the
whole parent size.

This fixes the previews for flip&cover window switchers.
FIXED-IN: 5.93.0

M  +23   -0    src/kcms/tabbox/layoutpreview.cpp
M  +20   -0    src/kcms/tabbox/layoutpreview.h

https://invent.kde.org/plasma/kwin/-/commit/3572e6f0e773eb82008b6799faac8278e009ae5a
Comment 9 Ismael Asensio 2024-01-13 15:07:58 UTC
Git commit 7bd9fe68277b2d9eaab64ab7a3056c0cdc3e4666 by Ismael Asensio.
Committed on 13/01/2024 at 16:07.
Pushed by iasensio into branch 'Plasma/6.0'.

kcms/tabbox: Add mock-up object for KWin.DesktopBackground

The window switcher previews don't use the actual quick components
the KWin plugin provides, but mock-up objects of those.

Add a mock-up component for `KWin.DesktopBackground`, which is just
a thumbnail of the desktop default image but stretched to cover the
whole parent size.

This fixes the previews for flip&cover window switchers.
FIXED-IN: 5.93.0

(cherry picked from commit 3572e6f0e773eb82008b6799faac8278e009ae5a)

M  +23   -0    src/kcms/tabbox/layoutpreview.cpp
M  +20   -0    src/kcms/tabbox/layoutpreview.h

https://invent.kde.org/plasma/kwin/-/commit/7bd9fe68277b2d9eaab64ab7a3056c0cdc3e4666