监控苹果“系统事件”含可可

发布于 2024-09-24 02:05:42 字数 141 浏览 1 评论 0原文

我想知道是否有一种方法可以编写一个 Cocoa 应用程序来侦听操作系统系统事件,例如应用程序启动、窗口切换等。我的想法是观看 [NSNotficationCenter default] 消息,但到目前为止我还没有没能找到很多。有人有什么建议吗?

谢谢!

I was wondering if there was a way to write a Cocoa app that listened for OS system events such as an application launching, a window switches, etc, etc. My thought was to watch [NSNotficationCenter default] for messages but so far I haven't been able to find much. Does anyone have any suggestions?

Thanks!

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

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

发布评论

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

评论(1

り繁华旳梦境 2024-10-01 02:05:42

您可能感兴趣的一些消息将提供给 [NSWorkspace notificationCenter],例如应用程序启动、到达前端或退出时。

我不确定你所说的“窗户开关”是什么意思。如果您的意思是更改前面的窗口而不更改前面的应用程序,那么在 Mac 上这通常被认为“与您无关”。

Some messages that might interest you would be provided to [NSWorkspace notificationCenter], such as when apps launch, come to the front, or quit.

I'm not sure what you mean by "window switches". If you mean changing which window is in front without changing which app is in front, that's generally considered "none of your business" on the Mac.

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