问题
Idea is simple(stolen from Ubuntu): autohide Dock when you drag window toward it and begin to overlap it. Turn autohiding off and show Dock when window is moved out of area when Dock is located.
What API can be used to achieve that ?
update:
managing autohide possible from command line this way but it's horrible
defaults write com.apple.dock autohide -bool true
killall Dock
回答1:
Well, when the Dock is configured to (always) stay visible, the Window Manager will simply refuse to position the window directly under the Dock. It prevents users from putting stuff to where they can't reach. (Not every user is a power user; not every user knows the Dock can be hidden and since the Dock has no click-throughs...)
The system will hide the Dock when the app goes fullscreen. But, again, the system takes care of it.
Aside from directly mucking around with the user's Dock preferences (never change a user's preference for a third-party app behind their back!) like you mentionned; it can't be done legitematly.
There's is no API to control the Dock... at best, you can only suggest a tile to represent your app when present on the Dock.
来源:https://stackoverflow.com/questions/17131380/what-api-can-be-used-to-hide-osx-dock-when-you-drag-a-window-towards-it