Bug 488277

Summary: Unable to leave session when using custom window manager
Product: [Plasma] plasmashell Reporter: nikht0 <nikhto>
Component: Session ManagementAssignee: Plasma Bugs List <plasma-bugs>
Status: CONFIRMED ---    
Severity: minor CC: dhruvmaru007, natalie_clarius, nate, xaver.hugl
Priority: NOR Keywords: regression
Version: 6.0.5   
Target Milestone: 1.0   
Platform: Manjaro   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description nikht0 2024-06-09 22:53:13 UTC
SUMMARY
Hello,

I use i3 as window manager, and I can't log out using the splash screen, nor any standard way.

STEPS TO REPRODUCE
1.  Start plasma with `KDEWM` set (for my case, `i3`) 
2. Try to log out using any method (krunner, `qdbus6 org.kde.Shutdown /Shutdown  org.kde.Shutdown.logout`)
3. Fail

OBSERVED RESULT
Journal control gives: 
```
plasma-shutdown[75648]: org.kde.plasma.shutdown: KWin failed to complete logout
```
EXPECTED RESULT
Logout should be successful.

It seems that the bug stems from "23cca93  shutdown: Introduce support for KWin closing wayland windows" which
sends a DBus request to the non-existent service "org.kde.KWin". Creating a mock service returning true to `org.kde.KWin.Session.closeWaylandWindows`  fixes the bug.

This has been evoked by Bug 481938 Comment 77 

Cheers,
Comment 1 Dhruv Maroo 2024-06-10 07:39:13 UTC
Hi,

I can also confirm that I have been facing this issue. I have been using a mock KWin DBus service[1] for quite a while. Obviously, this is just a hacky fix and not a proper solution. This commit[2] introduced the call to `closeWaylandWindows` when shutting down. I believe adding a simple isValid()[3] check for the `OrgKdeKWinSessionInterface` before calling any DBus methods should fix the issue.

[1]: https://github.com/DMaroo/fakwin
[2]: https://github.com/KDE/plasma-workspace/commit/23cca93b879d0fcf9f430b03a482dbca1e0a1d79
[3]: https://doc.qt.io/qt-6/qdbusabstractinterface.html#isValid