
Macos Notch Ui
- 257 installs
- 641 repo stars
- Updated May 27, 2026
- fayazara/macos-app-skills
Build Dynamic Island-style notch UI on macOS with safe-area layout, live activity states, animations, and accessibility around the camera housing.
About
Shows how to design and implement macOS notch UI: safe-area framing, live status surfaces, smooth expand-collapse animations, and accessible layouts that feel native around the MacBook camera housing.
- Notch safe-area layout patterns
- Live activity and status chips
- SwiftUI animation timing
- Accessibility around camera cutout
- Compact versus expanded notch states
Macos Notch Ui by the numbers
- 257 all-time installs (skills.sh)
- Ranked #863 of 1,880 Design & UI/UX skills by installs in the Skillselion catalog
- Data as of Aug 5, 2026 (Skillselion catalog sync)
npx skills add https://github.com/fayazara/macos-app-skills --skill macos-notch-uiAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 257 |
|---|---|
| repo stars | ★ 641 |
| Last updated | May 27, 2026 |
| Repository | fayazara/macos-app-skills ↗ |
What it does
Build Dynamic Island-style notch UI on macOS with safe-area layout, live activity states, animations, and accessibility around the camera housing.
Files
macOS Notch UI (Dynamic Island Style)
This skill creates a Dynamic Island-style overlay that extends from the MacBook's hardware notch. The overlay is a transparent floating panel positioned flush against the top of the screen, using a custom shape with concave "ear" curves that blend seamlessly with the physical notch cutout.
Architecture
The implementation has 3 parts:
1. `NotchWindow` (NSPanel subclass) -- a borderless, transparent, click-through panel at CGShieldingWindowLevel that sits above everything, including the menu bar 2. `NotchShape` (SwiftUI Shape) -- draws the Dynamic Island silhouette with concave quadratic Bezier curves at the top corners and convex rounded corners at the bottom 3. Your content view -- whatever you want to show inside the notch (status indicators, waveforms, text, icons)
How It Works
The MacBook notch is a black rectangle at the top-center of the screen. By placing a black-filled NotchShape at that exact position at the highest window level, it visually extends the notch area. Content inside the shape appears to "emerge" from the hardware notch.
The key positioning math:
// Use full screen frame (not visibleFrame) to include the menu bar / notch area
let screen = NSScreen.main!
let x = screen.frame.origin.x + (screen.frame.width - totalWidth) / 2
let y = screen.frame.origin.y + screen.frame.height - totalHeightUsing screen.frame (not screen.visibleFrame) is critical -- visibleFrame excludes the menu bar area where the notch lives.
Reference Files
references/NotchWindow.swift-- Drop-in NSPanel subclass with show/hide and positioningreferences/NotchShape.swift-- The Dynamic Island shape with animatable corner radii
Step-by-Step Integration
1. Add the NotchShape
Copy references/NotchShape.swift. This is a SwiftUI Shape with two configurable corner radii:
topCornerRadius(default 10) -- the concave "ear" curves at the top that mimic the hardware notch's inverse cornersbottomCornerRadius(default 16) -- the standard convex rounded corners at the bottom
Both are animatable via animatableData, so SwiftUI can smoothly interpolate shape changes.
2. Create Your Content View
Build whatever you want to show inside the notch. The content should be clipped to NotchShape and filled with black background:
struct NotchContentView: View {
var isVisible: Bool
var body: some View {
HStack {
Image(systemName: "mic.fill")
.foregroundStyle(.red)
Text("Recording")
.font(.system(size: 13, weight: .medium))
.foregroundStyle(.white)
}
.frame(width: isVisible ? 200 : 0)
.frame(height: 32)
.background(NotchShape().fill(.black))
.clipShape(NotchShape())
.animation(.spring(response: 0.35, dampingFraction: 0.75), value: isVisible)
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .top)
}
}3. Add the NotchWindow
Copy references/NotchWindow.swift. This is a generic NSPanel that:
- Creates a borderless, transparent, non-activating panel
- Positions at
CGShieldingWindowLevel(above everything) - Centers at the top of the screen, flush with the top edge
- Ignores mouse events (fully click-through)
- Joins all spaces and survives fullscreen
4. Show and Hide
// Create once and reuse
let notchWindow = NotchWindow()
// Show with your content
let content = NotchContentView(isVisible: true)
notchWindow.showNotch(content: content)
// Hide with spring collapse animation
notchWindow.hideNotch()Spring Animation Choreography
The Dynamic Island effect comes from a specific animation sequence:
Show: 1. Window appears instantly (orderFront) 2. On the next runloop tick, isVisible toggles to true 3. The width animates from 0 to the target width with .spring(response: 0.35, dampingFraction: 0.75)
This two-step approach (instant window, then animated content) is necessary because SwiftUI needs the view to be in the hierarchy before it can animate.
Hide (3-step choreography): 1. Clear any expanded content (text, details) -- collapses to compact shape 2. After 0.25s, set isVisible = false -- triggers the spring width collapse to 0 3. After 0.65s, remove the window (orderOut)
The delays are tuned so each animation completes before the next starts. This creates the smooth "shrink into the notch" effect.
// Step 1: collapse content
state.isExpanded = false
// Step 2: shrink width
DispatchQueue.main.asyncAfter(deadline: .now() + 0.25) {
state.isVisible = false
}
// Step 3: remove window
DispatchQueue.main.asyncAfter(deadline: .now() + 0.65) {
window.orderOut(nil)
}Screen Geometry Details
| Property | Value | Why |
|---|---|---|
| Window level | CGShieldingWindowLevel() | Above everything including menu bar |
| Position origin | NSScreen.main.frame (not visibleFrame) | Must include the notch/menu bar area |
| Horizontal | Centered: (screen.width - totalWidth) / 2 | Aligned with the hardware notch |
| Vertical | Flush top: screen.height - totalHeight | Top edge touches the screen edge |
| Collection behavior | .stationary, .canJoinAllSpaces, .fullScreenAuxiliary, .ignoresCycle | Doesn't move with Spaces, survives fullscreen, hidden from Cmd+Tab |
Fallback for Non-Notch Macs
Not all Macs have a notch (e.g., external displays, older MacBooks). You can detect this:
var hasNotch: Bool {
guard let screen = NSScreen.main else { return false }
// Notch Macs have a safe area inset at the top
return screen.safeAreaInsets.top > 0
}For non-notch displays, fall back to a floating pill at the bottom of the screen using screen.visibleFrame and standard .floating window level.
Design Guidelines
- Fill the shape with solid black -- this is what makes it blend with the hardware notch
- Use white or colored text/icons on the black background for contrast
- Keep content compact -- the notch area is small. A single row with an icon + short text works best
- Use red for recording indicators -- matches iOS convention
- Animate width, not opacity -- the Dynamic Island effect is about the shape growing/shrinking, not fading
//
// NotchShape.swift
// {{AppName}}
//
// Dynamic Island-style shape with concave "ear" curves at the top corners
// (mimicking the MacBook notch) and convex rounded corners at the bottom.
//
// The top corners use quadratic Bezier curves that bow outward, creating the
// inverse rounded corner effect seen on the hardware notch. The bottom corners
// are standard convex rounded corners.
//
// Both corner radii are animatable, so SwiftUI can smoothly interpolate
// shape changes (e.g., expanding from compact to expanded state).
//
import SwiftUI
struct NotchShape: Shape {
var topCornerRadius: CGFloat
var bottomCornerRadius: CGFloat
init(topCornerRadius: CGFloat = 10, bottomCornerRadius: CGFloat = 16) {
self.topCornerRadius = topCornerRadius
self.bottomCornerRadius = bottomCornerRadius
}
var animatableData: AnimatablePair<CGFloat, CGFloat> {
get { .init(topCornerRadius, bottomCornerRadius) }
set {
topCornerRadius = newValue.first
bottomCornerRadius = newValue.second
}
}
func path(in rect: CGRect) -> Path {
var path = Path()
// Start at the top-left corner
path.move(to: CGPoint(x: rect.minX, y: rect.minY))
// Top-left "ear": concave curve bowing inward
path.addQuadCurve(
to: CGPoint(x: rect.minX + topCornerRadius, y: rect.minY + topCornerRadius),
control: CGPoint(x: rect.minX + topCornerRadius, y: rect.minY)
)
// Left edge down to bottom-left
path.addLine(to: CGPoint(x: rect.minX + topCornerRadius,
y: rect.maxY - bottomCornerRadius))
// Bottom-left convex rounded corner
path.addQuadCurve(
to: CGPoint(x: rect.minX + topCornerRadius + bottomCornerRadius, y: rect.maxY),
control: CGPoint(x: rect.minX + topCornerRadius, y: rect.maxY)
)
// Bottom edge
path.addLine(to: CGPoint(x: rect.maxX - topCornerRadius - bottomCornerRadius,
y: rect.maxY))
// Bottom-right convex rounded corner
path.addQuadCurve(
to: CGPoint(x: rect.maxX - topCornerRadius,
y: rect.maxY - bottomCornerRadius),
control: CGPoint(x: rect.maxX - topCornerRadius, y: rect.maxY)
)
// Right edge up to top-right
path.addLine(to: CGPoint(x: rect.maxX - topCornerRadius,
y: rect.minY + topCornerRadius))
// Top-right "ear": concave curve bowing outward
path.addQuadCurve(
to: CGPoint(x: rect.maxX, y: rect.minY),
control: CGPoint(x: rect.maxX - topCornerRadius, y: rect.minY)
)
// Close along the top edge
path.addLine(to: CGPoint(x: rect.minX, y: rect.minY))
return path
}
}
//
// NotchWindow.swift
// {{AppName}}
//
// A borderless, transparent, click-through NSPanel that positions itself
// flush against the top of the screen at the highest window level, directly
// over the MacBook's hardware notch area.
//
// Usage:
// let window = NotchWindow()
// window.showNotch(content: MyNotchContentView())
// window.hideNotch()
//
import AppKit
import SwiftUI
class NotchWindow: NSPanel {
/// Shadow padding around the content to allow for drop shadows or glow effects.
/// Increase if your content has large shadows.
var shadowPadding: CGFloat = 20
/// The width of the content area (excluding shadow padding).
var contentWidth: CGFloat = 360
/// The height of the content area (excluding shadow padding).
var contentHeight: CGFloat = 140
init() {
super.init(
contentRect: .zero,
styleMask: [.borderless, .nonactivatingPanel],
backing: .buffered,
defer: false
)
isOpaque = false
backgroundColor = .clear
hasShadow = false
isMovableByWindowBackground = false
ignoresMouseEvents = true
}
/// Show the notch overlay with the given SwiftUI content.
///
/// The window is positioned at `CGShieldingWindowLevel` (above everything)
/// centered at the top of the main screen, flush with the top edge.
func showNotch<Content: View>(content: Content) {
// Place above everything, including the menu bar
level = NSWindow.Level(rawValue: Int(CGShieldingWindowLevel()))
collectionBehavior = [.stationary, .canJoinAllSpaces, .fullScreenAuxiliary, .ignoresCycle]
let totalWidth = contentWidth + shadowPadding * 2
let totalHeight = contentHeight + shadowPadding
if let screen = NSScreen.main {
let x = screen.frame.origin.x + (screen.frame.width - totalWidth) / 2
let y = screen.frame.origin.y + screen.frame.height - totalHeight
setFrame(CGRect(x: x, y: y, width: totalWidth, height: totalHeight), display: false)
}
let hosting = NSHostingView(rootView:
content
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .top)
)
hosting.translatesAutoresizingMaskIntoConstraints = false
contentView = hosting
alphaValue = 1
orderFront(nil)
}
/// Show as a floating pill at the bottom of the screen (fallback for non-notch Macs).
func showPill<Content: View>(content: Content) {
level = .floating
collectionBehavior = [.canJoinAllSpaces, .fullScreenAuxiliary]
let size = CGSize(width: contentWidth, height: contentHeight)
if let screen = NSScreen.main {
let x = screen.visibleFrame.midX - size.width / 2
let y = screen.visibleFrame.minY + 30
setFrame(CGRect(origin: CGPoint(x: x, y: y), size: size), display: false)
}
let hosting = NSHostingView(rootView:
content
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .center)
)
hosting.translatesAutoresizingMaskIntoConstraints = false
contentView = hosting
alphaValue = 1
orderFront(nil)
}
/// Hide with a fade-out animation.
func hideNotch(completion: (() -> Void)? = nil) {
NSAnimationContext.runAnimationGroup({ ctx in
ctx.duration = 0.3
animator().alphaValue = 0
}, completionHandler: { [weak self] in
self?.orderOut(nil)
completion?()
})
}
/// Whether the current main screen has a hardware notch.
static var screenHasNotch: Bool {
guard let screen = NSScreen.main else { return false }
return screen.safeAreaInsets.top > 0
}
}