How do I know the size of the dock?

In my application, I need to know what size the docking station is currently running by my application (I do not want to change the docking station, I only know its size). Here is what I have found so far:

  • there is no direct way to interact with the dock

  • using com.apple.dock.plist, I can know the pleating and the number of constant applications and the constant of others, so I can "calculate the size of the dock", but only for constant elements. What I want is the size of the docking station at the moment I ask about it, and there may be other running applications that are not listed in persistent applications in plist, so my calculated size is wrong.

Has anyone encountered the same problem? Do I need to iterate over every running application to guess if it has an item in the dock? Is there any other easier way to get the size of the dock?

Any ideas are welcome. Thank you in advance for your answers, tips ...

+4
source share
1 answer

In addition to NSDockTile, also look at NSScreen to calculate the size of the dock.

+3
source

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


All Articles