Skip to content

feat(gpui): hold off App Nap during batches and remember the window state - #96

Merged
yeagoo merged 8 commits into
mainfrom
fix/gpui-macos-nap-window-state
Oct 25, 2026
Merged

yeagoo merged 8 commits into
mainfrom
fix/gpui-macos-nap-window-state

Conversation

@yeagoo

@yeagoo yeagoo commented Oct 25, 2026

Copy link
Copy Markdown
Contributor

概要

生命周期修复计划 PR-D:

  • 批次运行期间申请 gpui 的 idle-sleep 防护(macOS 上为 UserInitiated 活动断言),批次结算后释放,避免 App Nap 降速与空闲睡眠打断长批次
  • 主窗口记住显示器(UUID)、窗口化位置与内容尺寸(显示器局部坐标)、最大化与全屏;退出时写入 gpui-window-state.json(不改与 Tauri 共享的 settings.json)
  • 显示器不在或可见部分不足 100×100 / 标题栏不可达时,回到主显示器居中默认尺寸;损坏的文件视为无
  • 窗口停稳 500 ms 才记为恢复位置(缩放/全屏动画的中间帧不会被记住);模式在每次尺寸变化与关闭按钮时刷新(窗口内退出时无法再读窗口)
  • 复核后不需要显示器局部坐标的 vendored 补丁,偏差记录于计划 §7

验证

  • GPUI 全部测试与 clippy 通过;新增叠放双显示器、回退、损坏文件、窗口内关闭保持全屏、退出全屏后关闭等测试
  • macOS 13.6 虚拟机:批次中 pmset -g assertions 出现 PreventUserIdleSystemSleep "Converting images",结束后消失;位置/尺寸精确恢复;全屏 ⌘Q 后重启仍全屏,退出全屏回到原位;最大化关闭后重启仍最大化,再缩放回到原尺寸;退出全屏后立即关闭保存为窗口化
  • Codex 评审两轮:P1(窗口内退出丢失模式)与 P2(退出全屏后关闭仍记为全屏)已修复

🤖 Generated with Claude Code

yeagoo and others added 8 commits October 25, 2026 03:41
The bridge acquires gpui's idle-sleep prevention (a user-initiated
activity on macOS) when a batch starts and releases it once the batch
has settled.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The main window reopens on the display it was on (by UUID), at its last
windowed rectangle in display-local coordinates, maximized or in full
screen as it was left. A rectangle that would show too little of the
window, or a display that is gone, falls back to a centred default. The
state is saved to gpui-window-state.json from the quit coordinator.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Zoom and full-screen animations pass through windowed frames, which
became the restore rectangle.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The close button and the menus quit inside the window's update, where the
quit hook cannot read the window; the mode is now followed on every
bounds change, and the opening place seeds the state.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Leaving full screen resizes the window before AppKit reports the exit,
so the mode noted on that resize still read full screen.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@yeagoo
yeagoo merged commit 8a4ee8e into main Oct 25, 2026
10 checks passed
@yeagoo
yeagoo deleted the fix/gpui-macos-nap-window-state branch October 25, 2026 05:56
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