Repository navigation
feat(presentation): presentation mode with manual start and mirror trigger - #504
Merged
Merged
Conversation
tieubao
force-pushed
the
feat/presentation-mode
branch
from
November 15, 2026 20:25
b72f2d4 to
023e5d4
Compare
Manual start (shortcut, arrow menu, capsule) and one automatic trigger, display mirroring, hold a strict allow-list: every app hidden, or the hidden section shown minus the sensitive apps. Every change to what is held goes through one function in NativeVisibilityEngine. It lifts while a camera or microphone is on (resumes 2.5 s after both are idle) and when the app quits. General tab: Presentation mode group; the pane scrolls inside a 720 pt window.
tieubao
force-pushed
the
feat/presentation-mode
branch
from
November 15, 2026 20:53
07c5df6 to
838348e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Presentation mode (F4, direct build on macOS 27). While it is on, every app except the keep-list is hidden, and the apps in the sensitive list stay hidden even when the arrow is clicked.
presentationShortcut), an item in the arrow's context menu ("Start/Stop Presentation Mode", the shortcut shown beside it), and the "Presenting" capsule (click for what is hidden and why, and Stop Presenting).presentationAutoMirrorEnabled, default off), read from the existing screen-parameters notice withCGDisplayIsInMirrorSet.hold(whenBar:)) and one reconcile (reconcileHold) inNativeVisibilityEngine. An app launch, a clock click,pressClock's restore and any re-activation compute the list from current state, so the strict list is never swapped back to the normal one while presenting. Turning the mode off recomputes the normal list (the exact pre-mode list when nothing else changed). Quit releases explicitly (willTerminate) as well as by process exit; a crash fails open.Pref keys
presentationAutoMirrorEnabled.numberpresentationSensitiveApps[bundleId: true].dictionarypresentationShortcut.datapresentationModeActiveAll three user-facing keys are in
SettingsWindowTests(legacyBoolKeys/legacyOtherKeys, the Bool row is aboundSwitch) and inAppStoreMigrationTests.appKeys. The direct-only rows are in the App Store hidden-rows test.Decisions (Han approved the plan; these are the calls I made inside it)
presentationAutoSlideshowEnabledkey, row or code. Future work: build it only after the wave verifier's live Keynote check passes (frontmost app plus a whole-display window it owns). No screen-share detection, no "display added" or AirPlay trigger.NativeVisibilityEngine.presentationSystemItems.PreferencesWindowController.maxWindowHeight); a pane taller than that is hosted in a scroll view, others are untouched. The height test now asserts the cap and that General scrolls and About does not.Tests
Full
scripts/test.sh(both schemes), exit 0: direct 474 passed, 0 failed (HiddenBarTests + HiddenTests); App Store 328 passed, 0 failed. (Parallel clones on the shared Mini sometimes die with "test runner exited before establishing connection" while another worker's tests run; re-running, or--no-parallel-testing, is clean.)New tests:
PresentationStateTests(state machine: manual, mirror cause, stop, capture pause, quiet period, flap, refused hold),PresentationModeEngineTestsinMenuBarEngineTests.swift(swap before drop, app launch while presenting, stop restores the exact list, sensitive apps on the expanded list, clock click, capture lift and resume, flap, start while capturing, no layout, out-of-order completions, refused list fails open, quit lifts, mirror start and stop, manual outlives mirror),DisplayMirroringTests, andPresentationViewsTests(Settings group, direct-only gating, dictionary storage, picker, panels, pause copy, note, capsule, menu shortcut).Negative control
Committed first, then one production change reverted or mutated per run,
bash scripts/test.sh --scheme direct --no-parallel-testing, exit 1 each time, restored withgit checkout -- <path>(tree clean after each):startPresentationdoes nothingtestManualStartSwapsToTheStrictList,testStartWhileExpandedCollapsesTheBar,testStopRestoresTheNormalListIncludingNewAppstestMirrorTriggerHoldsAndLiftstestCaptureStartLiftsTheRestrictionAtOnce,testResumesTwoAndAHalfSecondsAfterCaptureEnds,testStartWhileCaptureIsActiveNeverHoldstestAFlappingMicrophoneDoesNotFlapTheBar,testFlappingCaptureNeverHidesEarly,testResumesAfterTheQuietPeriod,testResumesTwoAndAHalfSecondsAfterCaptureEndsallowLaunchedAppsIfIdle)testAppLaunchWhilePresentingKeepsTheStrictList,testExpandedWhilePresentingKeepsSensitiveAppsHidden,testOutOfOrderCompletionsNeverLeaveTheWrongListHeldtestRefusedStrictListFailsOpentestQuitLiftsTheRestrictiontestStopRestoresTheExactPreModeList,testStopRestoresTheNormalListIncludingNewApps,testOutOfOrderCompletionsNeverLeaveTheWrongListHeld,testMirrorTriggerHoldsAndLiftsThe capture tests run with the 1.11.2 option off, so only the presentation pause can lift them.
Snapshots (offscreen,
-settingsSnapshotDir, fixture data, no pref written)direct-present-<state>-<light|dark>.pngforpill(Light and Dark boards: capsule, panel with why, hidden apps, sensitive apps, Stop),paused(Edge board: Paused capsule and explanation),click(Edge board: the arrow note),failed(no board), andsettings(Settings board: the General tab scrolled to the Presentation group). The scrolling General tab is indirect-general-<light|dark>.png. The Entry board's context menu is an NSMenu and cannot render offscreen; its title and shortcut are unit tested. Compared by eye with the boards; the panel, capsule, chips, copy and rows match, with the pause copy deliberately reworded (capsule, not light) and the slideshow row removed.Live checks left for the wave verifier
Clock and battery system item ids; how two overlapping assertions combine during a swap; the real mirrored-display name (the mirroring display is often absent from
NSScreen.screens, so the copy then says "a display"); the capsule's position among the status items.