Cold Turkey lock mechanics — macOS kiosk factsheet (probe) #159
Notifications
Due Date
No due date set.
Blocks
#162 Build S2: WritingLock — kiosk, chrome integration, unbroken typing
AlexKucera/museion
Reference: AlexKucera/museion#159
Reference in new issue
Block a user
Question
What EXACTLY does macOS enforce for an app-kiosk lock, and what is the minimal correct recipe for Museion? Probe on this machine (macOS 27, latest Xcode) — write a tiny AppKit probe in the scratch dir, run it, read back
NSApp.currentPresentationOptions, and report observed behavior, not docs alone:NSApplicationPresentationOptionshold and under what conditions (fullscreen? key window?):disableProcessSwitching(⌘Tab),disableForceQuit,disableSessionTermination(logout/restart),hideMenuBar,hideDock— and the autoHide fallbacks.applicationShouldTerminaterefusal cover it, or must the menu item die?), ⌘W close, ⌘M minimize, Mission Control / Spaces swipes, hot corners, Dock reachability, notification-center pull, Stage Manager, force-quit via the login window.toggleFullScreenvsenterFullScreenMode, when to set/clear presentationOptions around the transition (pairing, auto-clear on exit), and how fullscreen composes with the focus-mode recession chrome (#87 — WorkspaceView/PostEditorView swap surfaces).Deliverable: factsheet — exact option set + minimal Swift entry shape, every claim probe-backed. Post as the resolution comment on this ticket; the
docs/research/cold-turkey-lock-mechanics.mdfile lands with the build's authorized commits.Constraints: app-kiosk ONLY (Screen Time / Family Controls are map-out-of-scope). No privileged helpers. ADR-0009 (no sandbox) holds. Standing rule: no commits/pushes — probe artifacts stay in the scratch dir.
Part of #158
[Generated by AI]
Cold Turkey lock mechanics — macOS kiosk factsheet (probe-backed)
Probed live on this machine: macOS 27.0.1, Xcode 27 / MacOSX27.2 SDK (
kioskprobe.swift, scratch dir, windowed + fullscreen AppKit probe; raw phases quoted in §7). Every claim carries a label: [probe] = observed on this machine, [docs] = Apple documentation/header, [practice] = community-consensus behavior, verify live.1. Verdict — the exact recipe
NSApp.keyWindow—toggleFullScreenis the right primitive (see §4 for whyenterFullScreenModeis rejected). [probe]applicationShouldTerminate → .terminateCancel,windowShouldClose(_:) → false. No menu items need to die. [probe]Optional hardening bits (all valid alongside the set, all held bit-exact [probe]):
.disableAppleMenu(whole Apple menu dead — only matters during transition flashes),.disableMenuBarTransparency, and macOS 27+ only:.disableScreenCornerInteractions(if #available(macOS 27, *)) — the official Hot Corners kill switch; on macOS 26.x hot corners are only suppressed in practice bydisableProcessSwitching[practice].Do NOT use autoHide variants for the lock:
autoHideMenuBaraccepts either dock bit, buthideMenuBarstrictly requireshideDock[probe, §5]. The lock wants hide-everything; autoHide exists for peek-style apps.Do not reach for
.fullScreenAuxiliaryor.disableHotKeys— they no longer exist in the macOS 27 SDK (§5).2. Which option holds under which condition
disable*bit and both menu-bar bits require.hideDock/.autoHideDock, enforced by an ObjC exception at set time — in Swift that is a process abort, not a degradation. [probe].fullScreen. [probe]3. Every escape route
applicationShouldTerminate → .terminateCancel(all quit paths route throughterminate:)NSApp.terminate(nil), delegate refused, app kept runningwindowShouldClose → false— probe:performCloserefused, window stayed on screenminiaturize:); probe:performMiniaturizein fullscreen →isMiniaturized false, windowed →true.disableHideApplication.disableProcessSwitching.disableScreenCornerInteractions(macOS 27 release note: "…which you can use to disable Hot Corners"); ≤26: suppressed in practice bydisableProcessSwitching+hideDock.hideDock— "Dock is entirely unavailable".disableForceQuit— "Cmd+Opt+Esc panel is disabled".disableSessionTermination— "PowerKey panel and Restart/Shut Down/Log Out disabled"Ranked: bug-if-open = anything in the covered rows found live during the prototype ticket; acceptable-open = physical login-window/power, and (pending that live check) Notification Center + Spotlight + Stage Manager.
4. Fullscreen mechanics + typing continuity
Pairing (enter): assign options, then
toggleFullScreen(nil). Probe C: set-before-toggle held bit-exact after the space settled. Ordering is forgiving since the combo also holds windowed (A8) — but set-then-toggle is the clean order. [probe]Pairing (exit):
toggleFullScreen(nil)alone. Probe E2: after the fullscreen exit,presentationOptionsread back[]— auto-cleared on macOS 27. Don't rely on it: clear explicitly inwindowDidExitFullScreen(idempotent, guards 26.x where this was not observed). [probe, one observation — flagged]Transition caution: don't churn options mid-transition. Assignments ~0.4 s after a toggle read back stale/merged for up to ~1 s (D1/D3 anomaly). Set once; verify via
NSApp.currentSystemPresentationOptionsafterdidEnterFullScreensettles. [probe]Typing continuity — CLEAN, no deferral needed [probe]: exiting fullscreen with the full combo active preserved first-responder object identity (same NSTextView), and the window stayed key (
fs=false key=true resp=textView, identity checktrue). Mechanism:toggleFullScreenis a window-level space/geometry transition — the responder chain and the SwiftUI content hierarchy are untouched. The known remount hazard (#87: focus toggle remounts MentorPaneView/PostsLibraryColumn) is the focus toggle's own app code, not fullscreen; the lock's enter/exit adds no remount (probe: contentView + responder identity held throughout).Rejected:
NSView.enterFullScreenMode— legacy fake fullscreen: window does not gain the fullscreen style mask, first responder is stolen at entry (probe L2: responder became the bare NSWindow), andexitFullScreenModetrapped the probe process on macOS 27. [probe]If a build revision ever introduces responder churn, the named deferral mechanism: timestamp keyboard events via an
NSEventlocal monitor for.keyDown(or an NSTextViewkeyDownoverride) into alastKeystroke: Date; fire the geometry exit only whenDate().timeIntervalSince(lastKeystroke) > ~1 s, re-arming on each keystroke — event timestamps, not a polling timer;textDidChangealso fires per edit but keyDown is the direct signal.5. macOS 27 API changes (this SDK; compile + header evidence)
NSApp.currentPresentationOptions→NSApp.currentSystemPresentationOptions— the old name fails to compile against MacOSX27.2. Any Museion code or doc using the old name must move. [probe: compile error].fullScreenAuxiliaryand.disableHotKeys— absent fromNSApplication.h, compile errors. Apple is narrowing kiosk API, not widening it. [probe: compile error].disableScreenCornerInteractions(bit 15,macos(27.0)), requires.hideDockor.autoHideDock. Alone it is silently dropped — setter returns, no exception, stored options read[](contrast thedisable*family, which throws). [probe]hideDock+autoHideDock: "Both NSApplicationPresentationHideDock and NSApplicationPresentationAutoHideDock were specified; only one is allowed"hideMenuBarwithouthideDock: "NSApplicationPresentationHideMenuBar specified without NSApplicationPresentationHideDock" — notehideMenuBardemands HIDE specifically;autoHideMenuBaraccepts either dock bitdisableForceQuit/disableMenuBarTransparency/disableProcessSwitching/disableSessionTerminationwithout a dock bit: "One of … was specified without either NSApplicationPresentationHideDock or NSApplicationPresentationAutoHideDock"6. Sanity line (ticket's own)
Word-goal blocks carry no clock; time-goal blocks do — nothing to research; the readout is the prototype ticket's.
7. Evidence — selected probe output (kioskprobe, macOS 27.0.1 / SDK 27.2)
Probe artifacts:
~/.hermes/cache/scratch/kioskprobe.swift(+ binary). The repo copy lands asdocs/research/cold-turkey-lock-mechanics.mdwith the build's authorized commits.[Generated by AI]