endSessionDialog, loginManager: Get the session ID from logind if XDG_SESSION_ID unset
If we're started by systemd, we won't be in the user's display session. However, this is still the session that will get locked & unlocked. Ask logind what the 'display' or 'greeter' session is, and watch for the Unlock signal for that session to know when to unlock.
See: https://wiki.gnome.org/Initiatives/SystemdUser
I left some log()
that I was using for testing in, not sure if you would like them in the final version or not - happy to remove. & my javascript isn't the best so happy to receive style tips too.