Skip to content

[mac] fix: allow scratchpad window to be resized#372

Merged
Shpigford merged 1 commit into
mainfrom
claude/wonderful-archimedes-b1e0b8
May 17, 2026
Merged

[mac] fix: allow scratchpad window to be resized#372
Shpigford merged 1 commit into
mainfrom
claude/wonderful-archimedes-b1e0b8

Conversation

@Shpigford

Copy link
Copy Markdown
Owner

Summary

  • The scratchpad panel had .resizable in its styleMask but couldn't actually be resized. NSHostingController defaults its sizingOptions to [.minSize, .intrinsicContentSize, .maxSize] on macOS 13+, so the hosting view pinned the window to SwiftUI's intrinsic size via a .maxSize Auto Layout constraint. preferredContentSize and translatesAutoresizingMaskIntoConstraints = false were earlier workarounds for the same machinery — they kept the panel from collapsing on first show, but locked it at its initial size.
  • Set sizingOptions = .minSize and drop the workarounds. The SwiftUI minimum still propagates as a constraint, but .intrinsicContentSize / .maxSize no longer fight user resize.
  • Bumped the minimum from 360×280 to 420×320 so the centered "New Scratchpad" title can't overlap the traffic lights or the new-note button. Mirrored on win.minSize, win.contentMinSize, and the SwiftUI shell's .frame(minWidth:minHeight:).
  • Bumped the frame autosave key to ClearlyScratchpadWindow_v2 so any stale sub-minimum frame saved by earlier builds is discarded — first launch picks up the default 480×560.

Test plan

  • ⌃⌥⌘N opens the scratchpad at 480×560 in the top-right.
  • Drag any edge or corner — the window resizes smoothly.
  • Drag inward — the window stops at 420×320 and won't go smaller.
  • Resize to a new size, close the scratchpad, reopen — the new frame persists.
  • At the minimum width, the "New Scratchpad" title is fully visible and clear of the traffic lights and the new-note button.

The scratchpad panel had `.resizable` in its styleMask but two later
additions blocked actual resize:

- `NSHostingController` defaults its `sizingOptions` to
  `[.minSize, .intrinsicContentSize, .maxSize]` on macOS 13+, so the
  hosting view pinned the window to SwiftUI's intrinsic size with a
  `.maxSize` Auto Layout constraint.
- `preferredContentSize` plus
  `translatesAutoresizingMaskIntoConstraints = false` were band-aids for
  the same machinery — they prevented the panel from collapsing on first
  show, but kept the window locked there.

Switching `sizingOptions` to `.minSize` (and dropping the band-aids)
keeps the SwiftUI-driven minimum but lets the user grow the window
freely. The min bumped to 420×320 so a centered "New Scratchpad" title
can't overlap the traffic lights or the new-note button, and
`contentMinSize` is set redundantly so the constraint applies to the
content rect under `.fullSizeContentView`.

Autosave key bumped to `ClearlyScratchpadWindow_v2` so any stale
sub-minimum frame written by earlier builds is ignored.
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying clearly with  Cloudflare Pages  Cloudflare Pages

Latest commit: d462c4e
Status: ✅  Deploy successful!
Preview URL: https://e81124e4.clearly-cjz.pages.dev
Branch Preview URL: https://claude-wonderful-archimedes.clearly-cjz.pages.dev

View logs

@Shpigford Shpigford merged commit cb0f40b into main May 17, 2026
3 checks passed
@Shpigford Shpigford deleted the claude/wonderful-archimedes-b1e0b8 branch May 17, 2026 12:07
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