سؤال

I am trying to detect time since last user input using the X11 Screen Saver extension client library. I make periodic calls to XScreenSaverQueryInfo to get the idle time. The problem I am facing is that after every 20-30 seconds the idle time, as reported by this call, resets to 0. This happens even though there has been no actual user input in that time. I am totally puzzled by this. The only lead I have is that the problem disappears if I uninstall gnome-screensaver. My question is, does the gnome-screensaver simulate user inputs for some reason? I know it sounds unlikely, and if it does, it will most definitely be a bug with gnome-screensaver, but I cannot think of anything else right now. Does anyone know where I can find more information on how gnome-screensaver works and how it influences the XScreenSaverQueryInfo call without actually having to go through the code. I have gone through the info at gnome-screensaver home but could not find anything relevant to my issue.

Update: I got the following output from dbus-monitor. How do I interpret this:

method call sender=:1.97538 -> dest=org.gnome.ScreenSaver serial=3 path=/org/gnome/ScreenSaver; interface=org.gnome.ScreenSaver; member=SimulateUserActivity

I think some process is asking gnome-screensaver to SimulateUserActivity. Or, is gnome-screensaver sending a SimulateUserActivity signal to dbus? If it is the first, how can I find out which process is asking gnome-screensaver to do that?

هل كانت مفيدة؟

المحلول

Once you have the dbus sender (as shown on dbus-monitor there) you can do:

dbus-send --print-reply --dest=org.freedesktop.DBus /org/freedesktop/DBus org.freedesktop.DBus.GetConnectionUnixProcessID string:':1.97538'

plugging in the actual sender. That gives you the pid that's sending the message.

Then say the pid is 2144, you'd do:

cat /proc/2144/cmdline

as one way to see what the program is.

نصائح أخرى

A program (video players does this while playing video) might be sending a gnome-screensaver-command --poke command which will send a SimulateUserActivity event to reset the idle time which will prevent screensaver becoming active.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top