Re: org.freedesktop.PowerManagement always available?
Thiago Macieira <[email protected]> Tue, 08 Apr 2025 16:56:08 -0700
| Newsgroups | gmane.comp.freedesktop.dbus |
|---|---|
| Message-ID | <3522051.LZWGnKmheA@tjmaciei-mobl5> |
On Tuesday, 8 April 2025 08:18:50 Pacific Daylight Time [email protected] wrote: > Hello, > I am an upstream maintainer not knowing much about DBus. But I took over > that old project [1] which is using DBus to inhibit hibernation on > desktop systems. > Now I need to make some decisions regarding that piece of code I don't > fully understand. So please apologize my dumb questions. > > The code is iterating over 3 different session managers to execute this > inhibit method; Gnome, Mate and Freedesktop. > > 1. My initial question is if this make even sense to you, trying three > different managers? Unfortunately, yes. That's a case of https://xkcd.com/927/: "one standard to rule them all" becomes "yet another standard" What you should investigate is whether the standard solution with XDG is available everywhere where you software is reasonably expected to run. Or, put in other words, if you can drop support for the environments that only don't support it. Look for when the org.freedesktop.PowerManagement service and interface specifications were published and when the major desktops adopted them. > 2. To my research the freedesktop session manager is somehow connected > to tjhe "upower" package which is available on most GNU/Linux systems. > If "upower" is installed (maybe because it is a dependency of my > application) can I rely on the fact, that the freedesktop manager will > always be available? So I could get rid of the two other managers and > the iteration? That's not a correct assumption. On my KDE Plasma desktop, that interface is provided by powerdevil, which has no direct dependency on upower. It does use upower behind the scenes, but it may have other backends via the Solid library. However, that strict dependency is not a requirement for your dropping support for the older power management inhibition mechanisms.