是否有 API 用于检索 Mac OS X 上当前打开的应用程序的图标?我正在尝试检索活动应用程序的所有图标以及应用程序顶部的任何徽章(即邮件中的新消息数或传输中的当前下载速率)。有某种 Dock API 吗?
我能找到的唯一提到用于检索当前活动应用程序信息的 OSX API 是 Process Manager API,其中没有提到轮询 Dock 或检索图标数据的功能。
就应用程序图标而言,我找到的唯一文档与 NSWorkspace 相关: https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/Workspace/introduction.html
Is there an API for retrieving the icons of the currently open apps on Mac OS X? I am trying to retrieve all the icons of the active applications along with any badges on top of the application (i.e. number of new messages in mail, or current download rate in Transmission). Is there some sort of Dock API?
The only mention of an OSX API for retrieving information about currently active applications I have been able to find is the Process Manager API, which does not mention the ability to poll the dock or retrieve icon data.
As far as application icons, the only documentation I have found is related to NSWorkspace: https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/Workspace/introduction.html
发布评论
评论(1)
看起来Theocacao 有一个详细记录的 NSWorkspace 示例,用于获取打开的应用程序并检索其图标 。没有提及这是否也会检索应用程序图标的徽章/修改,或者是否有办法订阅与图标更新相关的通知。
检索活动应用程序:
检索应用程序的图标:
Looks like Theocacao has a well documented sample of NSWorkspace being used to obtain open applications and retrieve their icons. There isn't any mention of whether this will also retrieve badges/modifications to the application's icon or if there is a way to subscribe to notifications related to updates of the icon.
Retrieving active applications:
Retrieving an application's icon: