用户空闲时间在 Linux 上 30 秒后重置为 0 [英] User idle time being reset to 0 after 30 secs on Linux

查看:35
本文介绍了用户空闲时间在 Linux 上 30 秒后重置为 0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 X11 屏幕保护程序扩展客户端库检测自上次用户输入以来的时间.我定期调用 XScreenSaverQueryInfo 以获得空闲时间.我面临的问题是,每隔 20-30 秒,此调用报告的空闲时间将重置为 0.即使在此期间没有实际用户输入,也会发生这种情况.我对此感到非常困惑.我唯一的线索是,如果我卸载 gnome-screensaver,问题就会消失.我的问题是,gnome-screensaver 是否出于某种原因模拟了用户输入?我知道这听起来不太可能,如果确实如此,那肯定是 gnome-screensaver 的一个错误,但我现在想不出其他任何事情.有谁知道我可以在哪里找到有关 gnome-screensaver 的工作原理以及它如何影响 XScreenSaverQueryInfo 调用的更多信息,而无需实际阅读代码.我已经浏览了 gnome-screensaver home 上的信息,但找不到任何内容与我的问题相关.

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.

更新:我从 dbus-monitor 得到以下输出.我该如何解释:

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

我认为某些进程要求 gnome-screensaver 来模拟用户活动.或者,gnome-screensaver 是否向 dbus 发送 SimulateUserActivity 信号?如果是第一个,我怎样才能找出哪个进程要求 gnome-screensaver 这样做?

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?

推荐答案

一旦您拥有 dbus 发送器(如 dbus-monitor 所示),您可以执行以下操作:

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'

插入实际的发件人.这为您提供了发送消息的 pid.

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

然后说 pid 是 2144,你会这样做:

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

cat /proc/2144/cmdline

作为查看程序内容的一种方式.

as one way to see what the program is.

这篇关于用户空闲时间在 Linux 上 30 秒后重置为 0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆