监控用户空闲时间

发布于 2024-07-15 00:58:31 字数 61 浏览 4 评论 0原文

开发 Mac 应用程序时,如何判断用户当前是否在计算机前? 或者他们上次按下按键或移动鼠标是多久以前的事?

Developing a mac app, how can I tell whether the user is currently at their computer or not? Or how long ago they last pressed a key or moved the mouse?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

陌路黄昏 2024-07-22 00:58:31

您可以使用 Quartz 事件点击和 NSTimer。 每当您的事件水龙头之一亮起时,都可以通过设置其触发日期来推迟计时器。 当计时器触发时,用户处于空闲状态。

不过,我不确定 Quartz 事件点击是否暴露给 Python。 绘图 API 是,但我不确定事件点击。

You can use Quartz event taps and an NSTimer. Any time one of your event taps lights up, postpone the timer by setting its fire date. When the timer fires, the user is idle.

I'm not sure whether Quartz event taps are exposed to Python, though. The drawing APIs are, but I'm not sure about event taps.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文