Split KSMServer to be just an XSessionManager
Closed, ResolvedPublic

Description

Rationale:

  • it was a bit of a dumping ground
  • for wayland we might want to replace the session manager
  • for systemd units we want to replace the autostart/shutdown code
  • it's a pre-requisite to making xwayland optional/ondemand

First step is to tidy and split

davidedmundson added a comment.EditedOct 1 2018, 11:27 AM

subtasks:

  • move the completely unrelated subdirs out (ON REVIEW)
  • move switch user out completely (DONE)
  • split server.h to match cpp files (DONE)
  • KSMServer should gain new logout/shutdown as explicit new methods on a new service name org.kde.shutdown, ready for moving (DONE)
  • move logout prompt to be a DBus activatable job that is fire & forget which launches prompt (DONE) on selection this calls relevant logout/shutdown/whatever
  • invoke logout prompt directly from libkworkspace (following user's "show prompt" configuration) or call org.kde.shutdown directly
  • Shutdown will get a new DBus activated helper (called from logout prompt, taking the org.kde.shutdown name). This will:
    • ask ksmserver to do xsession shutdown tasks + get success/fail back (needs exposing)
    • run shutdown scripts
    • call logind / end the session
  • Move startup into it's own process. This startup should:
    • launch ksmserver and somehow get back the SESSION_MANAGER env
    • launch the rest
    • exit?...but somehow not have SDDM/kwin_wayland think the session has ended

Then when we've done all this, we can go about replacing whatever

romangg added a subscriber: romangg.Oct 1 2018, 9:46 PM
davidedmundson added a comment.EditedFeb 15 2019, 1:14 AM

libkworkspace plans:

  • rm most the old stuff
  • brand new QML friendly public API which will call prompts/shutdown etc.
  • "semi-public" backend exposing Logind, CK2 and CK1 (latter is still needed for BSD) for use by ksmserver / whatever inside p-w
  • suspend and hibernate will also be here
  • powerdevil will be ported to this API and drop its own code
  • end user code will use the new libkworkspace API which will call messages on logind, rather than pointlessly going through powerdevil to call message logind.

Current code is in davidedmundson/libkworkspace2

Relevant branches of p-w

davidedmundson/kworkspace2
davidedmundson/ksession

I'm trying to treat them as independent projects, though ksession will require kworkspace2 for people to use correct methods to invoke shutdown etc.

One afterthought that I'm not sure how to solve: Ksmserver currently does the screensaver on X, there's a security feature that if ksmserver crashes (and thus your screensaver) your session goes away. Not sure how true it is anyway given one could just freeze ksmserver and then kill the greeter.

I want to change kwin X11's dependency on ksmserver spawning it.

KSMserver has to treat it very differently, and kwin's session management code is unlike any other XSMP process. If we did any XSMP replacement kwin would still treat it very differently. Maybe we should just have 2 nice DBus calls to kwin and replace the session management there.

It would allow for a huge startup boost on X and also help the wayland case.

davidedmundson moved this task from Work in Progress to Done on the Plasma board.Sep 25 2019, 10:55 PM
ngraham closed this task as Resolved.Sep 27 2019, 3:07 PM