Bug 485697

Summary: Screen dialog allow restore on future sessions doesn't work
Product: [Plasma] xdg-desktop-portal-kde Reporter: Marcelo Bossoni <mmbossoni>
Component: generalAssignee: Plasma Bugs List <plasma-bugs>
Status: RESOLVED DUPLICATE    
Severity: normal CC: aleixpol, dashonwwIII, jgrulich, nate, ruinairas1992, stefanfunk1998
Priority: NOR Keywords: regression
Version: 6.0.4   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In: 6.1.0
Sentry Crash Report:

Description Marcelo Bossoni 2024-04-17 19:59:10 UTC
SUMMARY
When selecting a screen to share dialog have a checkbox for "Allow restore on future sessions" (sorry I'm translating back from my language) and it is selected by default but it doesn't work

STEPS TO REPRODUCE
1. launch steam with -pipewire
2. select a screen and make sure Allow restore checkbox is marked
3. exit steam and launch steam again with -pipewire

OBSERVED RESULT
Screen picker dialog is shown again

EXPECTED RESULT
Screen picker dialog is not shown...

As an addendum, KDE lacks any tools to revoke those permissions 
As a second addendum, this seems to also be true for KDEConnect remote input plugin

SOFTWARE/OS VERSIONS
Operating System: Arch Linux 
KDE Plasma Version: 6.0.4
KDE Frameworks Version: 6.1.0
Qt Version: 6.7.0
Kernel Version: 6.8.7-1-cachyos (64-bit)
Graphics Platform: Wayland
Processors: 16 × AMD Ryzen 7 5700X 8-Core Processor
Memory: 31.3 GiB of RAM
Graphics Processor: AMD Radeon RX 6750 XT
Manufacturer: Micro-Star International Co., Ltd.
Product Name: MS-7A37
System Version: 1.0

ADDITIONAL INFORMATION
Comment 1 stefanfunk1998 2024-04-18 15:28:35 UTC
can confirm this issue for myself as well, specifically for kdeconnect

this issue was there once in the past, where the checkmark on the screen share dialog didnt do anything, but it got fixed at some point, so that i could seamlessly connect with kdeconnect without confirming it

i think the issue appeared again starting with the big plasma 6 update
Comment 2 Matthew 2024-06-01 17:03:35 UTC
*** Bug 487894 has been marked as a duplicate of this bug. ***
Comment 3 Matthew 2024-06-01 17:57:23 UTC
I am unable to screenshare with Element and Discord because it keeps prompting me to select the window source. This might be related to the fact that programs like OBS are not able to save the window information to be opened up the next time the program is opened.
Comment 4 Bug Janitor Service 2024-06-01 18:12:36 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/xdg-desktop-portal-kde/-/merge_requests/290
Comment 5 Nicolas Fella 2024-06-03 16:09:13 UTC
Git commit cc37d9414b83206f72f77d91b6ac1ffd03d112b1 by Nicolas Fella.
Committed on 01/06/2024 at 18:11.
Pushed by nicolasfella into branch 'master'.

Fix screencast window restoration check

We are searching for a window by UUID. The model gives us a QVariant containing a QByteArray and we compare it to a QString

This doesn't work and we never find any window

Force the variant to QString to fix the comparison

M  +1    -1    src/screencast.cpp

https://invent.kde.org/plasma/xdg-desktop-portal-kde/-/commit/cc37d9414b83206f72f77d91b6ac1ffd03d112b1
Comment 6 Nicolas Fella 2024-06-03 16:09:52 UTC
Git commit 2d8e54e8c39e61acc22f40d0c1a73910692acff9 by Nicolas Fella.
Committed on 03/06/2024 at 16:09.
Pushed by nicolasfella into branch 'Plasma/6.1'.

Fix screencast window restoration check

We are searching for a window by UUID. The model gives us a QVariant containing a QByteArray and we compare it to a QString

This doesn't work and we never find any window

Force the variant to QString to fix the comparison
(cherry picked from commit cc37d9414b83206f72f77d91b6ac1ffd03d112b1)

M  +1    -1    src/screencast.cpp

https://invent.kde.org/plasma/xdg-desktop-portal-kde/-/commit/2d8e54e8c39e61acc22f40d0c1a73910692acff9
Comment 7 stefanfunk1998 2024-06-25 15:55:37 UTC
i'd like to add that with the newest kwin/kde update, the issue is not resolved for me, on every new boot kdeconnect needs to have the window confirmed (with checkmark) to work

the issue got even worse actually, because now even using virtual mouse input through steam's controller input system requires confirming the window before controllers are allowed to send mouse clicks / button presses
Comment 8 Nate Graham 2024-06-26 20:13:04 UTC

*** This bug has been marked as a duplicate of bug 480235 ***
Comment 9 Matthew 2024-07-04 15:24:53 UTC
I'm not sure if I want to open up a bunch of bug reports since I think they are all sort of similar, so I'm going to list the issues here. If I need to open up bug reports for any of these, just let me know.

1 -  Attempting to cast your screen more than once can cause future screen casts to fail in programs like Webcord/Discord, Guilded, Element, Telegram Desktop, and more.
2 -  When you are casting a windowed full-screen application, such as a game, the rendering for that program will stop when you click on it to bring it to focus. When you press the Windows key to remove focus the game will continue to render. If you select "pipewire source window" in OBS and do the same thing to try and record the window it will also stop the game from rendering. If you screen cast your entire display you won't have this issue.
3 - Each window source that you are casting in programs like OBS will have it's own "capture" window in your app indicators, I think this should stack and not fill up my entire task bar as I decorate my OBS streams. When you stop casting I've noticed that these app indicators stay indicating that something may be going wrong when attempting to stop the cast, likely related to issue 1.
4 - Screen casting a program forced to be ran in xwayland, such as the Discord client, will result in the xvideo bridge crashing when you launch a game and attempt to change your window source to this game. When this happens all programs running under xwayland will close without warning and when you open up Steam again any attempts to launch games will fail.
5 - For some reason Electron based program windows can become unresponsive only after attempting to screen cast at some point. It seems like a domino affect after experiencing issues above.

All of these issues popped up after pulling in the new KDE 6.1 updates which I believe shipped the "fix" for this problem. I apologize for leaving all of this as a comment here, but honestly the amount of issues are staggering and trying to troubleshoot all of them at once is overwhelming to think about when you just want to work or play on your computer.