Re: Preferred way for an application to inhibit suspend on KDE
- Date: Fri, 20 Jan 2017 12:44:48 +0100
- From: Harald Sitter <sitter@xxxxxxx>
- Subject: Re: Preferred way for an application to inhibit suspend on KDE
On Fri, Jan 20, 2017 at 11:58 AM, elboulangero <elboulangero@xxxxxxxxx> wrote:
> I'm writing an application that needs to prevent the system from
> suspending. I strive to support every GNU/Linux desktops, and I'm a bit
> stuck with KDE. I didn't find any obvious way to do that.
> On GNOME and related, I would use the D-Bus service
> 'org.gnome.SessionManager'. On XFCE, it would be
> 'org.xfce.SessionManager'. For other environments that lack a Session
> Manager, I can still rely on 'org.freedesktop.PowerManagement'.
> However I found none of these on KDE. Does it mean that I should turn to
> the system bus and use 'org.freedesktop.login1' (therefore assuming
> systemd existence) ?
org.freedesktop.PowerManagement is definitely working in Plasma.
org.kde.Solid.PowerManagement is technically the native interface for
this, goes to the same binary as org.freedesktop.PowerManagement, and
considering the freedesktop interface is deprecated it may be a wise
choice to use this name instead. So this is probably the "best" way to
inhibit on Plasma specifically.
org.freedesktop.login1 should technically work and for all intents and
purposes is the most Linux-wide way of inhibiting right now.
FWIW, I would always call login1. In fact, I would always call
everything, worst case you inhibit on multiple fronts, but given 1
inhibition is equal to N inhibitions it makes no difference. Trying to
figure out which of the 5 gazillion interfaces to call is nothing but
a source of tears.