Created attachment 459582 [details, diff]
Patch to liblightdm-gobject/power.c to use ConsoleKit for Suspend/Hibernate
When using =>x11-misc/lightdm-1.18.3 it is not possible to select Suspend or Hibernate on the LightDM login screen of a Gentoo installation that does not use systemd. This is because x11-misc/lightdm uses systemd-logind for Suspend/Hibernate, with upower as the fallback. I am assuming that sys-power/upower, sys-power/pm-utils and sys-auth/consolekit are installed.
In an installation that does not use systemd the Suspend and Hibernate entries in the Power pull-down menu on the LightDM GTK Greeter (x11-misc/lightdm-gtk-greeter-2.0.1-r1) are greyed-out and unusable.
In an installation that does not use systemd, the Suspend button on the LightDM KDE Greeter (lightdm-kde-0.3.2.1-r1) is greyed-out and unusable. (The Hibernate button is configured by default to be hidden, but would also be greyed-out were it configured to be visible.)
I have not tried the other LightDM greeters, but, due to the current coding in liblightdm-gobject/power.c, I cannot conceive that Suspend/Hibernate could be selectable from any of the greeters in an installation that does not use systemd.
The current code of liblightdm-gobject/power.c uses org.freedesktop.login1 for each of Suspend, Hibernate, Restart and Shutdown. The code falls back to org.freedesktop.UPower for Suspend/Hibernate, and falls back to org.freedesktop.ConsoleKit for Restart/Shutdown.
The attached patch to power.c replaces the use of UPower with ConsoleKit.
If I apply the attached patch, Suspend and Hibernate buttons on the GTK Greeter are no longer greyed-out and they can be used to Suspend/Hibernate the machine. (Unfortunately, the code of lightdm-kde-0.3.2.1-r1 is several years old and only appears to cater for org.freedesktop.UPower, therefore, even with the attached patch applied to x11-misc/lightdm-1.18.3, Suspend/Hibernate are still inactive on the KDE Greeter.)
I added a comment in LightDM Bug Report No. 1631707 about the lack of support for Suspend/Hibernate for non-systemd installations:
As a result, LightDM developer Robert Ancell has kindly pushed a modified version of my patch that also fixes support for KDE greeters into the LightDM trunk, 1.20, 1.18 and 1.10 branches. So hopefully upcoming LightDM versions 1.21.4, 1.20.1, 1.18.4 and 1.10.7 will include support for Suspend/Hibernate on the login screen for both non-systemd and systemd installations. His commit log explains the update as follows:
Use power management functions from ConsoleKit2 if available.
Suspend and hibernate functionality was removed from upower 0.99.0, so systems not using systemd had no suspend/hibernate functionality. Support for this was added into ConsoleKit2.
Most systems will either be systemd or ConsoleKit2 now, so we try the following:
1. Power management in logind
2. Power management in ConsoleKit
3. upower for suspend/resume (really only here to not break backwards
Based on a patch for Gentoo by Fitzcarraldo.
His has long been implemented by upstream. Marking this bug as obsolete.
Thanks for your great work Fitzcarraldo and sorry this bug didn't get the attention it deserved.