在linux中检测键盘、鼠标活动 [英] detecting keyboard, mouse activity in linux

查看:18
本文介绍了在linux中检测键盘、鼠标活动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要一种方法来检测 Linux 上的鼠标/键盘活动.类似于任何 IM 程序所做的事情.如果在 5 分钟内未检测到任何活动,它会将您的 IM 状态设置为我现在不在这里".

I need a way to detect mouse/keyboard activity on Linux. Something similar to what any IM program would do. If no activity is detected for, say 5 minutes, it will set your IM status to "I'm not here right now".

对此的任何帮助表示赞赏.

Any help towards this is appreciated.

谢谢.

推荐答案

或者简单地使用命令xprintidle,它返回以毫秒为单位的空闲时间.

Or simply use the command xprintidle which returns the idle time in milliseconds.

它已被打包用于基于 debian 的系统.(源代码在原始站点 dtek.chalmers.se/~henoch 上不再可用,但您可以在 packages.ubuntu.com)

It has been packaged for debian based systems. (the source is not available any more on the original site dtek.chalmers.se/~henoch but you can get it at packages.ubuntu.com)

更多关于freshmeat.net的信息

这篇关于在linux中检测键盘、鼠标活动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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