[xmonad] 'resetScreenSaver' from 'Graphics.X11.Xlib.Misc'

Dontdie YCH dontdieych at gmail.com
Wed Jan 21 06:22:40 UTC 2015


Hello,

I'm looking for what is proper method to inhibit screensaver(DPMS)
without xscreensaver, KDE, GNOME ... .

My video player 'bomi'(was cmplayer) try these, in order,

~~~
[App] Initialize screensaver functions.
[App] Try to connect 'org.gnome.SessionManager'.
[App] Failed to connect 'org.gnome.SessionManager'. Fallback to
'org.freedesktop.ScreenSaver'.
[App] Failed to connect 'org.freedesktop.ScreenSaver'. Fallback to
XResetScreenSaver().
[App] Disable screensaver with XResetScreenSaver().
~~~

But it does not working. I didn't know how I directly deal with X11
lib. Fortunately, I found 'resetScreenSaver' from
'Graphics.X11.Xlib.Misc' that say interface to XResetScreenSaver().

resetScreenSaver.hs :

~~~
import Graphics.X11.Xlib
import Graphics.X11.Xlib.Misc
import Control.Concurrent
import Control.Monad

main = do
    dpy <- openDisplay ""
    forever $ do
        putStrLn "reset"
        resetScreenSaver dpy
        threadDelay (5*1000000)
~~~


~~~
$ xset s 10
$ runhaskell resetScreenSaver.hs
~~~

Unfortunately, It does not working. `activateScreenSaver` and
`forceScreenSaver` also does not working.

But `xset s reset` is working as intended and also there is
`xdg-screensaver [ suspend | resume | reset ]` command from
'xdg-utils' package (Arch). It looks like abstraction layer for xset,
xscreensaver, KDE, GNOME ... .

So I'm curious about whether this is bug of xorg or I misunderstand
something. And what is right way to do this if I don't want any
screensaver daemon? `xset s` or `xdg-screensaver`?

Thanks.


More information about the xmonad mailing list