-
Notifications
You must be signed in to change notification settings - Fork 27
ScreenSaver Specification
Since version 4.0, Clight implements and offers org.freedesktop.ScreenSaver API in place of supporting org.freedesktop.PowerManagement.Inhibited signal.
ScreenSaver spec is better in virtually any way, as it is really meant to pause screen dimming and dpms/screensaver kicking in. Thus, for example:
- Inhibition is only held for videos
- Chromium will only keep is inhibition ON while you're in a tab that is playing video. If you change tab, ScreenSaver inhibition will be dropped.
Instead, PowerManagement API is meant to inhibit powersave functions like suspend to ram/disk.
Consequently it is used by eg: chrome while listening to music, your torrent application to inhibit suspend while downloading, etc etc.
Sadly, ScreenSaver spec does not have an Inhibited signal, thus Clight cannot know whether an inhibition has been requested to eg: your DE power manager.
Consequently Clight has to provide the API implementation itself.
It works like this:
- A program (Clight) creates a well known bus interface (org.freedesktop.ScreenSaver)
- Other programs call org.freedesktop.ScreenSaver.Inhibit/UnInhibit when needed
- Clight receives the request and paused its dimmer/dpms tools
But you cannot have multiple programs offering same bus name in dbus; therefore first program that will request org.freedesktop.ScreenSaver bus name will take its ownership.
This means that in major DEs ScreenSaver API will probably be provided by their power manager, instead of Clight.
In this case Clight starts monitoring dbus for org.freedesktop.ScreenSaver requests (same as busctl --user monitor org.freedesktop.ScreenSaver
), and acts accordingly, as if these requests were made directly to it.
Finally, note that Clight implements { Inhibit, UnInhibit, GetActive, SimulateUserActivity } methods, as it can be seen in its API wiki page.
Sadly it seems like chromium defaults to avoid inhibition for unknown Desktop Environment, as you can see here.
Thus, if you are on a WM, chromium will fallback to avoid gaining any inhibition lock at all.
Moreover on Gnome, Pantheon, Unity and Cinnamon org.gnome.SessionManager
interface will be used instead.
This means that for Clight inhibition to work in all those environments (both WMs and Gnome-related), you should force chromium to use freedesktop API, by starting it with:
XDG_CURRENT_DESKTOP=XFCE chromium
An issue has been opened on chromium to default to org.freedesktop.ScreenSaver on unknown environments; the fix is available since version 80.
Thanks to @mindrunner for its time spent testing, finding a solution and opening chromium issue for his i3 setup!