Skip to content

Add Open Recent submenu to File menu#82

Merged
RasputinKaiser merged 1 commit into
mainfrom
ux/file-menu-open-recent
Jun 22, 2026
Merged

Add Open Recent submenu to File menu#82
RasputinKaiser merged 1 commit into
mainfrom
ux/file-menu-open-recent

Conversation

@RasputinKaiser

Copy link
Copy Markdown
Owner

Summary

macOS convention for non-document apps: a File > Open Recent submenu that lists recently-scanned folder paths so users can re-launch a scan without reaching for the sidebar.

Submenu items route through the existing store.scanRecentPath(_:) API, which preserves the security-scoped re-grant flow — if a folder's bookmark has expired, the user is asked to re-pick the folder instead of silently failing.

Implementation

  • AppDelegate conforms to NSMenuDelegate; submenu's delegate set to self
  • recentScansSubmenu stored property rebuilt in-place on each menuNeedsUpdate(_:) call (cheap — bounded by RecentsStore.maxEntries = 8)
  • validateMenuItem gates scanRecentFromMenu on !store.isScanning (mid-scan disabled, matching the sidebar's existing scan-gated behavior)
  • Empty state shows a disabled "No Recent Scans" placeholder
  • "Clear Menu" item calls clearRecentScansMenu, which loops forget(path:) per entry

Test plan

  • swift test (54 tests in 5 suites pass)
  • swift build succeeds
  • ./script/public_upload_audit.sh passes
  • No surname "Zvirbulis"; GitHub handle "RasputinKaiser"

Test plan (visual E2E)

Manual: launch via bash ./script/build_and_run.sh, scan a folder, then open File > Open Recent — verify the path appears, click it, scan re-launches.

🤖 Generated with NCode

macOS convention for non-document apps: a File > Open Recent submenu that lists
recently-scanned folder paths so users can re-launch a scan without reaching for
the sidebar. Submenu items route through `store.scanRecentPath(_:)`, which
preserves the existing security-scoped re-grant flow — if the folder's bookmark
has expired, the user is asked to re-pick the folder instead of silently failing.

Implementation:
- AppDelegate conforms to NSMenuDelegate; the submenu's delegate is set to self
- `recentScansSubmenu` stored property is populated on first build, rebuilt
  in-place on each `menuNeedsUpdate(_:)` call (cheap — bounded by RecentsStore.maxEntries = 8)
- validateMenuItem gates scanRecentFromMenu on `!store.isScanning` (mid-scan
  disabled, matching the sidebar's existing scan-gated behavior)
- Empty state shows a disabled "No Recent Scans" placeholder item
- "Clear Menu" item calls clearRecentScansMenu which loops forget(path:) per entry
  (RecentsStore doesn't expose a clearAll API; the loop is bounded and rarely-used)

Co-Authored-By: NCode <noreply@noumena.com>
@RasputinKaiser RasputinKaiser merged commit 036228a into main Jun 22, 2026
6 checks passed
@RasputinKaiser RasputinKaiser deleted the ux/file-menu-open-recent branch June 22, 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