feat(session): verify switches and recover when the greeter stays away

logind accepts loginctl activate and SwitchToGreeter before the graphics
stack moves the seat, and SDDM 0.21 answers SwitchToGreeter with a greeter
whose logins never start a session. Each request is now confirmed within a
timeout and the previous session is reactivated on failure, so no path can
leave a blank VT. When nothing answers, both front-ends offer to restart
display-manager.service through polkit, and only after that is the session
terminated.
This commit is contained in:
BlackAngelTV committed 2026-11-04 15:42:22 +01:00
1 parent f7789cd639
commit b48ae70c24
5 files changed
+521 -54

No files matched your search

+18 -3
View File
@@ -4,10 +4,25 @@
namespace fws {
// Switches the seat to the given logind session (VT activation).
// Switches the seat to the given logind session (VT activation). The switch is
// verified and rolled back to the previous session when the seat never moves.
bool activateSession(const std::string& sessionId, std::string& error);
// Returns to the display manager greeter without rebooting.
bool switchToGreeter(std::string& error);
struct GreeterOutcome {
bool ok = false;
// True when no display manager answered and showing the greeter would end
// the current session: the caller has to confirm before retrying with
// allowTerminate = true.
bool forceRequired = false;
std::string error;
};
// Shows the display manager greeter again. GDM and LightDM are asked to switch
// without ending anything; SDDM 0.21 cannot do that safely (its SwitchToGreeter
// leaves a greeter whose logins never start a session), so the call reports
// forceRequired and the caller has to confirm first. With allowTerminate the
// session does not come back: GDM and LightDM have it terminated, and SDDM is
// restarted through polkit so a working greeter takes the seat again.
GreeterOutcome switchToGreeter(bool allowTerminate);
} // namespace fws