Hey, I wanted to ask about the intended use of the new xdg-session-management Wayland protocol and ways to use it in Qt apps.
As an application developer, I’d like my app to be able to restore its windows when it’s launched. The session management protocol can provide just that. With KDE 6.7 and Qt 6.12, I was able to get this working in my app.
However, loading the session ID is a bit inconvenient for clients in Qt, because the session ID needs to be passed when constructing a QGuiApplication (in argv with -session). This seems to be related to the session management on X. There, the client would tell the session manager about the restart command. But on Wayland this doesn’t seem to exist.
I’m not sure if I’m using the session management in the intended way. Is the protocol intended for restoring the client application state or the state of the whole desktop. In the MR for xdg-session-management (!18) this sounded like it was intended for restoring the whole desktop:
This helps for e.g., a compositor/client crashing (definitely not due to
bugs) or a backgrounded client deciding to temporarily destroy its
surfaces in order to conserve resources.
Whereas in the MR for xx-zones (!264), it was said that clients should use xdg-session-management for window restoration:
This protocol will be abused to restore window positions instead of using xdg-session-management
This might indeed be possible. But toolkits will prefer the more widely available, better supported and more complete protocol for this purpose, and that will bexdg-session-management(once merged).
If the protocol is intended for restoring window positions for clients when launched, shouldn’t there be a more convenient way in Qt to restore the session without messing with argc/argv? If so I’ll ask on the Qt forum, but I’m not sure if I understand the protocol correctly.