python - Linux 中的 GetLastInputInfo 等效于检测上次输入时间

标签 python linux time input

有没有GetLastInputInfo () 可以在 Linux 中使用的等价物?

目的是检测用户最后一次输入(键盘或鼠标)的时间。 我正在使用 python 编写程序脚本。

最佳答案

XScreenSaverQueryInfo

The idle field specifies the number of milliseconds since the last input was received from the user on any of the input devices. The event-mask field specifies which, if any, screen saver events this client has requested using ScreenSaverSelectInput.

关于python - Linux 中的 GetLastInputInfo 等效于检测上次输入时间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2482103/

相关文章:

c - 如何使用从 time.h 函数获取的日期和时间

php - 时间计算 时间格式减

Python Rest API POST 图像

python - 使用 super() 调用父类构造函数与使用父类名称

python - 清除 sys.path 后 python 如何进行导入 - 导入优先级

python - 捕获和重新抛出异常的替代方法

c - 如何检查文件是否关闭

java - nanoTime 的 System.out 不正确?

c++ - 如何在 Linux Mint 上安装 GCC 4.7.2?

linux - Incron 作业创建多个文件