jD91mZM2/xidlehook

use dbus signals to inhibit

Opened this issue · 0 comments

I noticed that there are currently two flags for inhibiting screen idle, one based on whether a window is full-screen, and another for when audio is playing. A third option could be to listen for dbus events org.freedesktop.ScreenSaver Inhibit and Uninhibit. The currently available flags --not-when-fullscreen, and --not-when-audio are not suitable for users who want their screens to dim when audio is playing in the background, but don't want dimming while watching a non-fullscreen video in e.g. a browser. xfce-screensaver describes similar functionality in their docs:

Inhibit
Request that saving the screen due to system idleness be blocked until UnInhibit is called or the calling process exits.


Here is an excerpt from dbus-monitor when starting and pausing a video in firefox:

method call time=1675597447.179251 sender=:1.801 -> destination=org.freedesktop.ScreenSaver serial=56 path=/ScreenSaver; interface=org.freedesktop.ScreenSaver; member=Inhibit
   string "firefox"
   string "video-playing"
...
method call time=1675597449.572570 sender=:1.801 -> destination=org.freedesktop.ScreenSaver serial=57 path=/ScreenSaver; interface=org.freedesktop.ScreenSaver; member=UnInhibit
   uint32 1651872344

And an excerpt for playing/pausing a video in vlc:

method call time=1675598374.664767 sender=:1.2436 -> destination=org.freedesktop.ScreenSaver serial=5 path=/ScreenSaver; interface=org.freedesktop.ScreenSaver; member=Inhibit
   string "vlc"
   string "Playing some media."
...
method call time=1675598376.934975 sender=:1.2436 -> destination=org.freedesktop.ScreenSaver serial=6 path=/ScreenSaver; inter
face=org.freedesktop.ScreenSaver; member=UnInhibit
   uint32 1476071733