Skip to content
This repository has been archived by the owner on Jun 17, 2024. It is now read-only.

Use gnome-session interfaces to end session where possible #126

Merged
merged 6 commits into from
Jul 7, 2020

Conversation

davidmhewitt
Copy link
Member

@davidmhewitt davidmhewitt commented Jun 12, 2020

Previously the EndSessionDialog class handled all the logic for which DBus interfaces to call when a logout/reboot/shutdown action was confirmed.

It was calling methods like terminate and reboot on org.freedesktop.login1, which is fine if you don't have an active session (i.e. you're in greeter mode). But when we're in a session, it's a lot cleaner to ask gnome-session to do these things for us as it handles talking to all of the active applications and asking them to close cleanly, rather than just killing them.

So I've moved that logic out of the dialog and it's only UI code that remains. Now, when we're in an active session and a logout/shutdown button is pressed, we call the logout/reboot/shutdown methods on org.gnome.SessionManager, which in turn spawns the EndSessionDialog via DBus and we either confirm or cancel that request depending on the outcome of the dialog.

If we're not in an active session, we spawn the dialog manually and then call the org.freedesktop.login1 methods as before.

I found that logging out on our focal builds was really hit and miss. Most of the time you'd just end up sat looking at your wallpaper with no wingpanel/plank etc and never get kicked back to the greeter. Then you'd have to power cycle the machine to get it working again. This fixes that.

It also hopefully closes applications in the session a bit more cleanly, so hopefully we'll see a few more things saving their state a bit better.

@jeremypw
Copy link
Collaborator

jeremypw commented Jul 3, 2020

I now realise this project is now a Focal branch so I need to work on it with Focal - which I cannot do at the moment.

@davidmhewitt
Copy link
Member Author

davidmhewitt commented Jul 3, 2020

Yes, the master branch of the indicator as a whole no longer works on Hera, but, there's nothing Focal specific about this branch/PR, and I think the necessary versions of wingpanel, plank and polkit agent are already released to stable on Hera now.

There was talk that we may want to backport this patch to Hera, but to do so we'd have to merge this branch directly into the juno branch to avoid commit ef60783 which breaks compatibility with Hera.

@jeremypw
Copy link
Collaborator

jeremypw commented Jul 3, 2020

But the Focal specific master has been merged into this now so it does not run on Hera. It needs to be rebased on a commit prior to ef60783 and a PR specifying merging at that point made (is that possible?). Will GitHub then stop requiring merging master?

@jeremypw
Copy link
Collaborator

jeremypw commented Jul 3, 2020

It would be nice to have this in Hera unless Odin release is imminent (which it does not seem to be).

Copy link
Member

@danirabbit danirabbit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems to work as expected, so let's try it in daily :)

@danirabbit danirabbit merged commit 7281f02 into master Jul 7, 2020
@danirabbit danirabbit deleted the dont-murder-session branch July 7, 2020 19:13
worldofpeace added a commit to worldofpeace/nixpkgs that referenced this pull request Oct 24, 2020
worldofpeace added a commit to NixOS/nixpkgs that referenced this pull request Oct 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants