OS X Dock API? Get the icon of an active OS X application with icons and other changes

Is there an API for getting open application icons in Mac OS X? I'm trying to get all the icons of active applications along with the icons at the top of the application (i.e. the number of new messages in the mail or the current download speed in the transfer). Is there any Dock API?

The only mention of the OSX API for retrieving information about currently active applications that I managed to find is the Process Manager API , which does not mention the ability to poll the dock or retrieve icon data.

Regarding application icons, the only documentation I found is related to NSWorkspace: https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/Workspace/introduction.html

+1
source share
1 answer

Theocacao seems to have a well-documented NSWorkspace sample that is used to get open applications and get their icons . There is no mention of whether they will also retrieve app icon / modifications or if there is a way to subscribe to notifications related to icon updates.

Getting active applications:

NSWorkspace * ws = [NSWorkspace sharedWorkspace]; NSArray * apps = [ws launchedApplications]; NSLog (@"%@", apps); 

Retrieving the application icon:

 NSWorkspace * ws = [NSWorkspace sharedWorkspace]; NSString * path = [ws fullPathForApplication:@"Safari"]; NSImage * icon = [ws iconForFile: path]; 
+2
source

Source: https://habr.com/ru/post/912957/


All Articles