Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cocoa : Repport click on dock icon

Tags:

cocoa

dock

Is there a way to report every mouse click on the application dock icon?

like image 974
Matthieu Riegler Avatar asked Jan 16 '23 04:01

Matthieu Riegler


1 Answers

Not completely safe (also activated by double-click on the application itself),
but definitely the most easy way to implement:

- (BOOL)applicationShouldHandleReopen:(NSApplication *)theApplication hasVisibleWindows:(BOOL)flag

Quote from NSApplicationDelegate Protocol Reference:

These events are sent whenever the Finder reactivates an already running application because someone double-clicked it again or used the dock to activate it.

like image 185
Anne Avatar answered Feb 19 '23 02:02

Anne