Skip to content

feat(palette): find a hidden icon by typing, open its menu and re-hide - #505

Merged
tieubao merged 2 commits into
developfrom
feat/find-hidden-icon
Nov 15, 2026
Merged

tieubao merged 2 commits into
developfrom
feat/find-hidden-icon

Conversation

@tieubao

@tieubao tieubao commented Nov 15, 2026

Copy link
Copy Markdown
Contributor

What

Type-to-find palette (F1), direct build on macOS 27 only, opt-in.

  • Settings, General, directly under "Keyboard shortcut": row "Find a hidden icon" with the shared ShortcutRecorderRow, pref findHiddenIconShortcut (Data, unset = feature off). The arrow's right-click menu gets "Find a Hidden Icon..." only while a shortcut is set.
  • The shortcut opens a panel under the arrow on the display with the pointer. It lists running hidden and always-hidden apps from MenuBarItemCatalog (icon, name, bundle id, section), filters by name or bundle id (case and accents ignored; name start, word start, inside the name, letters in order, bundle id), arrow keys move the selection.
  • Return: allow that one app, AXPress its icon so its own menu opens, re-hide when the menu closes. Command-Return moves the app to visible, Option-Return to always hidden (PinnedSectionEdits.set). Escape or losing key closes.
  • Edge states: no match, nothing hidden, Accessibility off, macOS item (Focus, Siri, Now Playing), engine unavailable, app quit since the last read (dropped from the list, named in the no-match copy), icon with no AX press.
  • The panel is our own non-activating key panel: typing needs no key monitor, no Input Monitoring, no Screen Recording, no new entitlement.

Why

Hidden icons are one click away only if you remember the arrow, then find the icon. Typing a few letters is faster and works from any app.

How Return works (decision: reuse the clock session pattern)

PaletteRevealSession (pure, HiddenBarTests) mirrors NotificationCenterSession: session id, polling, restore only if Hidden Bar changed the restriction and the user has not touched the bar since (userChangedBar() is forwarded from the engine). MenuBarEngine gets allowTemporarily(bundle) / endTemporaryAllow(): one extra bundle in the allow list through the existing activate (new restriction lands before the old one drops, so no flash), put back with the previous list. Any other activation (expand, collapse, section edit) clears the pending restore, so the engine's newer state always wins. The bar does not expand, so an always-hidden app opens too. Auto-collapse waits while a session is active.

Menu detection: a window of the app at layer >= 101 (menus and popovers) via the window list, no Screen Recording. Apps that open a panel (Dropbox) get no menu: after 0.8 s the session follows the app's focus, 15 s cap.

Decisions (no questions asked, per plan)

  • Results are ranked globally by match kind; section headers show only when each section's rows sit together (always for an empty query, and for the board's "pa" example), otherwise each row carries its section label.
  • Bundle id is shown as a second line on every row (goal item 2 lists it; the boards omit it).
  • Selection clamps at the ends (no wrap).
  • The "NEW" tag next to the Settings row title is not drawn (SettingsForm.row has no tag).
  • The Open board shows the other app's own menu, which is not our UI. The opening snapshot is the palette during the press instead.
  • Edge copy for engine-down and cannot-open is new (not on the boards).
  • Extra debug hooks beyond the three asked: palette-activate open|keep|hide, palette-close; palette-open [query]. dump-state gains palette and paletteSession.
  • test_selectingATab_titlesTheWindow height bound 780 -> 840: the row with its caption adds 61 pt to General. SG-06 makes that pane scroll and will reset this bound.
  • Test-only: PaletteController(ordersPanelFront: false) so unit tests never put a window on screen.

Not verified live

No live run (GUI safety). The AX press, the menu-open window-list probe and the lift timing are written from the clock code and the macOS 27 notes; the wave verifier should exercise palette-open, palette-query, palette-select, palette-activate open on a real hidden app.

Tests

  • Direct scheme, serial (scripts/test.sh --scheme direct --no-parallel-testing): 507 passed, 0 failed.
  • Full scripts/test.sh: App Store 347 passed, 0 failed. Direct 507 passed with 8 "test runner exited with code 0 before establishing connection" errors in parallel mode (repeated on re-run; no test failed, serial run is clean).
  • New: HiddenBarTests PaletteRanking, PaletteModel, PaletteKeyAction, PalettePlacement, PaletteRevealSession, plus PaletteAllowTests in MenuBarEngineTests; HiddenTests PaletteSettings, PalettePanel (includes the snapshot file list).
  • Pref-key tests: findHiddenIconShortcut in legacyOtherKeys, in the App Store hidden-rows list, in importableKeys and appKeys.

Negative control

Committed first, then one production mutation at a time, scripts/test.sh --scheme direct --no-parallel-testing, each exit 1 with assertion failures (no build failures), file restored by git checkout, tree clean at the end.

Mutation Failing tests
ranking ignores match kind everyKindOfMatch_isRankedInTheBoardOrder, 2 PaletteModel list tests, 6 panel tests
model drops the Accessibility state accessibilityOff_winsOverEverything, accessibilityOff_buttonOpensSystemSettings
session never restores allowPressWatchRestore, aSecondOpen_restoresTheFirst, noItem/noPress/nothingShown/panelApp restore tests
session ignores a user-changed bar userChangedBar_keepsTheBarAsLeft
engine allows nobody testAllowsOneAppThenPutsTheRestrictionBack
Command and Option Return swapped keysMapToTheBoardsActions
placement ignores the arrow centredUnderTheArrow, clampsToTheScreenEdges, panelOpensUnderTheArrow
settings row removed directGeneralTab_hasTheRowUnderTheKeyboardShortcut, recorderShowsAndClears..., fixtureDefaults...
whitelist forgets the key testWhitelistCoversEveryPreferenceKeyTheAppDefines
Command-Return goes to always hidden commandAndOptionReturn_moveTheApp
Return never closes the panel return_opensTheSelectedApp
macOS items lose their state macOSItems_getTheirOwnState, macOSItem_copy

Three unrelated tests (test_setters_roundTripAndPostPrefsChanged, test_menuBarApps_offShowsNoList, test_menuBarApps_popupsAndResetWriteThePinnedTable) also failed in two of the mutation runs and passed in every other run; they share UserDefaults.standard and look flaky, not caused by this change.

Snapshots vs boards

-settingsSnapshotDir output, fixture apps, drawn over the boards' wallpaper gradient. Read against Palette-Light, Palette-Dark, Palette-Edge, Palette-Settings: same width, row height, type sizes, highlight bolding (Pa, Pa, p...a), key hints (wrap to a second line at 380 pt, as the board's flex-wrap does), edge copy.

direct-palette-<state>-<light|dark>.png for: results (board Light and Dark, query "pa"), all, opening (Open board), nomatch, nothinghidden, accessibilityoff, macositem (the four Edge cells), appquit, cannotopen, enginedown (not on the boards). Plus direct-palette-settings-<light|dark>.png (General tab with the shortcut set) and the live direct-general-<light|dark>.png.

MANUAL row draft (for SG-07)

Settings table row: General (direct build, macOS 27) | Find a hidden icon: shortcut that opens a search under the arrow | findHiddenIconShortcut

Section "Find a hidden icon": Record a shortcut in Settings, General, under Keyboard shortcut (unset by default, so the feature is off; the arrow's right-click menu then also offers Find a Hidden Icon). The shortcut opens a small panel under the arrow on the display with the pointer. It lists hidden and always-hidden apps that are running. Type part of a name or bundle id; matches at the start of the name come first. Return opens that app's own menu without expanding the bar and hides it again when the menu closes (an app that opens a panel instead hides again when it loses focus, at most 15 seconds). Command-Return moves the app to the visible section, Option-Return to the always-hidden section, Escape or a click elsewhere closes. It uses the Accessibility permission hiding already needs; it never reads the screen. Focus, Siri and Now Playing cannot be opened from here (macOS keeps them out of Accessibility while icons are hidden). Debug builds accept palette-open [query], palette-query <text>, palette-select <bundle id>, palette-activate open|keep|hide, palette-close.

Rebase notes for the later workers

New Swift files live in group Palette (hidden/Features/Palette). Hook cases sit in one block in StatusBarController.debugPalette and one case line; the snapshot call is one #if HIDDENBAR_NATIVE_VISIBILITY block at the end of SettingsSnapshot.render; SettingsSnapshot.shoot lost private so the palette snapshot can reuse it.

Opt-in type-to-find palette for the direct build on macOS 27. A global
shortcut (unset by default) opens a panel under the arrow listing hidden and
always-hidden apps from the catalog, filtered by name or bundle id with prefix
matches first. Return allows that one app, presses its icon through
Accessibility so its own menu opens, and puts the restriction back when the
menu closes, as the clock session does. Command-Return keeps the app shown,
Option-Return always hides it. Edge states: nothing hidden, no match,
Accessibility off, a macOS item, engine unavailable, an app that quit, an
icon with no press.

Ranking, the state rules, key mapping, placement and the reveal session are
pure types with tests in HiddenBarTests; the panel, settings row and snapshots
are tested in HiddenTests. Pref key findHiddenIconShortcut (Data, unset).
A menu left open for 10 minutes or a panel that kept focus for 15 seconds
ended the session without re-hiding the allowed app, so it stayed visible in
a collapsed bar with no bound. Every ending now goes through the same restore
path: re-hide the one app if Hidden Bar lifted it, leave a bar the user changed.
@tieubao
tieubao force-pushed the feat/find-hidden-icon branch from ee1ff5a to 69b86d3 Compare November 15, 2026 20:16
@tieubao
tieubao merged commit 47086cf into develop Nov 15, 2026
3 checks passed
@tieubao
tieubao deleted the feat/find-hidden-icon branch November 16, 2026 01:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant