The Mac App Store Won't Let Window Managers Exist. I Shipped One Anyway.

An Apple Developer Technical Support engineer told me my app was impossible: “It’s not possible to use the Accessibility APIs from a sandboxed app… your only path forward here is to directly distribute your app.” 1 The app was a window tiler, the Accessibility API is the thing every window manager is built on, and every Mac App Store app runs inside the sandbox that forbids it. Last week, 941 Tiles went live on the Mac App Store anyway: one click in the menu bar and all of an app’s scattered windows snap into an even grid. The sandbox rule never bent. The trick was noticing that macOS already contains a privileged window-mover with Apple’s full blessing, and it takes JSON.

TL;DR

App Sandbox categorically blocks cross-app Accessibility calls, no entitlement unlocks it, and every Mac App Store app must be sandboxed. The window-manager category has been effectively closed to newcomers since June 2012; the tilers still on the store predate the mandate and run unsandboxed forever. 1 3 4

The sanctioned door: a sandboxed app may drive Apple’s Shortcuts engine via Apple events, and Shortcuts ships Find Windows / Move Window / Resize Window actions that move other apps’ windows with Apple’s own privileges. 2 5 My app computes where every window should go; a companion Shortcut does the moving. Delegation, not permission.

The engineering that made it real: authoring the companion.shortcut programmatically as a binary plist of WFWorkflowActions, a JSON frame-payload contract keyed to window z-order, guard rails against phantom windows and index overruns, and a dual-engine codebase that uses direct Accessibility in Developer ID builds and Shortcuts delegation in store builds.

First successful run on the machine that had failed five store builds: four scattered terminal windows to exact quadrant frames in 0.6 seconds.

Credit where it is due: the mechanism is proven in the wild by snApp (open source, 2023) and Align (2024). Reading snApp’s source is what turned “impossible”…

添加评论
点赞收藏
点踩分享查看原文
评论
?
参与讨论