What is the safe area on a Mac screen?
The safe area is the part of a screen that hardware does not cover. On a MacBook with a notch, it is the display minus the cutout. Apple’s AppKit exposes it as NSScreen.safeAreaInsets, which it describes as the distances from the screen’s edges at which content is not obscured.
Why it matters
An app that draws at the top of the screen needs to know how tall the notch is, or its content will sit behind the camera. Reading the inset lets the app place things correctly on each Mac, instead of hard coding a number that only fits one model. Apple lists the property as available from macOS 12.0.
Macs without a notch report a top inset of zero. That is also how an app can tell whether to use the notch or fall back to something else, such as a floating pill.
How NotchStar uses it
NotchStar finds the screen whose top inset is greater than zero, which is the screen with the notch. It then reads the left and right areas beside the notch to size its panel. If no screen has an inset, it uses the main screen and draws a pill. The code is in NotchController.swift.
Related
For the user side of the same idea, read the MacBook notch explained. For Macs with no cutout, see notch apps for Macs without a notch. Developers who work on Mac windows should also know AppKit.