Skip to content

Architecture

Roy Padina edited this page Oct 6, 2026 · 3 revisions

Architecture

One small Swift target, no dependencies beyond system frameworks (AppKit, SwiftUI, Carbon, ScreenCaptureKit, ServiceManagement). The Swift files in the repo root are compiled together by swiftc (Building from source).

File Responsibility
main.swift App entry and the Lister app delegate: status item, click handling (per-display click mode, ⌥-click, right-click), hover / empty-bar click and clock click monitors, the right-click menu, the icon bar panel, global shortcut registration, location check (/Applications), first-run hint, auto-rehide timer, menu mirroring and replay. Also the --list command-line mode and the log helper.
Hiding.swift Hiding via the private MenuBarClientCore assessment-mode allow-list: activate/release, building the allow-list from item positions, the 5 s refresh, re-apply after wake or display change, fail-open handling.
AX.swift Accessibility helpers: reading AXExtrasMenuBar items for every app (extras()), on-bar/parked/notch detection, opening, closing and pressing real menus.
Icons.swift Icon for a row: the app icon, or the item's real look cropped from a ScreenCaptureKit capture of the menu bar strip, cached per bundle id, item index and bar brightness.
Settings.swift The SwiftUI Settings window (general, hidden items, permissions, about) and the System Settings pane opener.
Info.plist Bundle id com.roypadina.SmartHiddenBar, version, LSMinimumSystemVersion 27.0, LSUIElement (no Dock icon).
build.sh Build, sign, package, install.
Assets/icons/ Three icon sets (fold-chevron, peek-strip, curtain-panel): app icon and menu bar hidden/shown images. gen.py regenerates them, preview.html previews.

Data flow

5 s poll / app launch / quit  ->  refreshHide()
   background: extras() (AX walk) + ownFrame()
   main: last = inventory,  applyHide() -> allow-list -> restrictMenuBar()
click / shortcut  ->  icon bar (last, filtered to off-bar)  ->  show() -> mirror() -> pick()
  • last is the latest inventory; the menu and the icon bar read it and never walk Accessibility on the main thread.
  • Defaults (UserDefaults): hidden, autoRehideSeconds, iconStyle (app or real), iconBarNames, iconBarSize (points, default 24), firstRunHintShown, clickModes (display name → cycle / toggle / bar), alwaysHidden, knownApps, newApps, hoverReveal, clickEmptyBar, plus the shortcut settings.
  • It is an accessory app (LSUIElement): no Dock icon, no main window.

See How it works for the behavior behind each step.

Clone this wiki locally