Macos: display windows and discover new windows

I would like to have a list of windows, which is pretty simple, but I need also:

  • A notification will be sent when a new window appears

  • will be notified when an existing window disappears

  • detects when window position / size changes

Do you have any ideas for this?

Thanks in advance

+3
source share
2 answers

The answer in this post should be very helpful: How does my application detect a change in the window of another application?

If you want to just get windows for your own application, you can use

int pid = [[NSProcessInfo processInfo] processIdentifier]; 

, , NSNotificationCenter .

+1

" " .
CGWindowListCreate(), , .

, NSDistributedNotificationCenter NSWindow. ( - )

0

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


All Articles