1

I am trying to detect whether the screensaver is inhibited, using xfce on Arch.

This command works when chrome (chromium) Inhibits:

dbus-send --print-reply=literal --type=method_call --dest=org.freedesktop.PowerManagement \
/org/freedesktop/PowerManagement/Inhibit org.freedesktop.PowerManagement.Inhibit.HasInhibit

However it doesn't work with vlc. The screen saver doesn't start when I play video with vlc tho.

It looks like powermanager doesn't get notified about vlc-s inhibition, but screensaver does, but I don't see a method, to query the screensaver about inhibition.

This is what I see on dbus on start/stop vlc and a youtube video in chrome.


dbus-monitor --session interface=org.freedesktop.ScreenSaver
--- VLC START ---
method call time=1662491009.469655
sender=:1.1716 ->
destination=org.freedesktop.ScreenSaver serial=25
path=/ScreenSaver; interface=org.freedesktop.ScreenSaver;
member=Inhibit
string "vlc"
string "Playing some media."

--- VLC STOP ---
method call time=1662491018.895743
sender=:1.1716 ->
destination=org.freedesktop.ScreenSaver serial=26
path=/ScreenSaver;
interface=org.freedesktop.ScreenSaver;
member=UnInhibit
uint32 210

--- chrome START ---
method call time=1662491026.467214
sender=:1.2337 -> destination=org.freedesktop.ScreenSaver serial=5
path=/org/freedesktop/ScreenSaver;
interface=org.freedesktop.ScreenSaver;
member=Inhibit
string "/usr/lib/chromium/chromium"
string "Video Wake Lock"

method call time=1662491026.468662
sender=:1.32 ->
destination=:1.34 serial=996
path=/org/freedesktop/ScreenSaver;
interface=org.freedesktop.ScreenSaver;
member=Inhibit
string "xfce4-power-manager"
string "Inhibit requested"

--- chrome STOP ---
method call time=1662491029.945141
sender=:1.2337 ->
destination=org.freedesktop.ScreenSaver serial=8
path=/org/freedesktop/ScreenSaver;
interface=org.freedesktop.ScreenSaver;
member=UnInhibit
uint32 211

method call time=1662491032.135892
sender=:1.32 ->
destination=:1.34 serial=1000
path=/org/freedesktop/ScreenSaver;
interface=org.freedesktop.ScreenSaver;
member=UnInhibit
uint32 212

--------------------------------------

dbus-monitor --session interface=org.freedesktop.PowerManagement.Inhibit
--- VLC START ---
nothing
--- VLC STOP ---
nothing

--- chrome START ---
method call time=1662491438.346199 sender=:1.2340 -> 
destination=org.freedesktop.PowerManagement serial=7 
path=/org/freedesktop/PowerManagement/Inhibit; 
interface=org.freedesktop.PowerManagement.Inhibit; 
member=Inhibit
string "/usr/lib/chromium/chromium"
string "Video Wake Lock"

method call time=1662491438.540545 sender=:1.2341 -> 
destination=org.freedesktop.PowerManagement serial=5 
path=/org/freedesktop/PowerManagement/Inhibit; 
interface=org.freedesktop.PowerManagement.Inhibit; 
member=Inhibit
string "/usr/lib/chromium/chromium"
string "Playing audio"

--- chrome STOP ---

method call time=1662491440.828614 sender=:1.2340 -> 
destination=org.freedesktop.PowerManagement serial=9 
path=/org/freedesktop/PowerManagement/Inhibit; 
interface=org.freedesktop.PowerManagement.Inhibit; 
member=UnInhibit
uint32 6

method call time=1662491443.011514 sender=:1.2341 -> 
destination=org.freedesktop.PowerManagement serial=6 
path=/org/freedesktop/PowerManagement/Inhibit; 
interface=org.freedesktop.PowerManagement.Inhibit; 
member=UnInhibit
uint32 14

Is it some bug or there is a way, to detect VLC's Inhibition?

0

1 Answer 1

1

I think you have figured this out yourself, but here's the answer

VLC calls (from your example):

  • Inhibit method of the org.freedesktop.ScreenSaver interface & service.

Chrome calls (from your example):

  • Inhibit method of the org.freedesktop.ScreenSaver interface & service.
  • Something else (xfce related) which makes also a call to org.freedesktop.ScreenSaver.Inhibit
  • Inhibit method of the org.freedesktop.PowerManagement.Inhibit interface of org.freedesktop.PowerManagement.Inhibit service.

So, effectively Chrome takes three inhibitor locks from two different interfaces (ScreenSaver and PowerManagement), and VLC only gets the inhibitor lock from the ScreenSaver interface. Those two interfaces are from two completely different services. Assuming the services have been implemented correctly, these work with completely different set of inhibitor locks.

The (now deprecated) org.freedesktop.PowerManagement inhibits only suspend[*] (CPU stopping), whereas org.freedesktop.ScreenSaver inhibits your system from going idle, which in practice inhibits the idle action, which usually means screensaver kicking in (usually locking and blanking the screen) and the suspend (CPU stopping).


[*]: There is a bug report for xfce-power-manager v. 1.6.1 which says that org.freedesktop.PowerManagement.Inhibit has been implemented incorrectly, and it inhibits also the screensaver (probably inhibits system going idle). As the ticket is still open, it is possible that the bug exists still in the latest xfce-power-manager (4.19).

5
  • Thank you for your reply. Unfortunately I still don't have solution to this. If PowerManagement Inhibition is deprecated, and VLC uses Screensaver than everything is ok. My problem is the same: I can't find a method to get a list of Screensaver inhibitions. Commented Jun 3, 2023 at 15:04
  • I'm afraid I do not understand your question correctly. I see you asked "Is it some bug or there is a way, to detect VLC's Inhibition?" and the answer is 1) No, there is no bug 2) I think you successfully detected with dbus-monitor VLC inhibiting ScreenSaver using the Inhibit method of the org.freedesktop.ScreenSaver interface. If that does not answer to the question, could you rephrase what you're trying to achieve? Commented Jun 3, 2023 at 15:47
  • You absolutely right, I am sorry. I asked the question wrongly. I want to query it, not detect it. So I want to query the currently active inhibitions, without the need to monitor it constantly. Commented Jun 4, 2023 at 15:14
  • 1
    Ok now I got it! I'm afraid the org.freedesktop.ScreenSaver does not provide a method to list the inhibitors. Since you're using xfce, in v.4.19.0 (April 2023) there is also org.xfce.Session.Manager interface with IsInhibited which tells if there is a inhibitor lock (but not, who is holding it). Commented Jun 4, 2023 at 16:19
  • Thank you, but I can't find the IsInhibited method which could be a solution for me. UPDATE: I am on 4.18.2, I supposed I have the latest on Arch, but I think I don't have to wait too long. Commented Jun 7, 2023 at 20:56

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.