[BUG] Desktop input dialog restores off-screen after 4K external monitor disconnect (macOS) — saved window-state not clamped to current displa
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
Description
The desktop dialog that Claude Code shows for user input restores its saved window position without validating it against the current display configuration. The position is saved while a 4K external monitor (3840×2160) is connected; when the dialog later appears on the laptop's built-in screen, it is rendered offset off the top of the screen — partially unreadable and not repositionable easily.
Environment
- Claude Code version: 2.1.246
- OS: macOS 26.5.2 (build 25F84), Darwin 25.5.0
- Hardware: MacBook Pro (Mac16,8) built-in display + 4K external monitor (3840×2160)
Steps to reproduce
- Connect a 4K external monitor to a MacBook Pro.
- Use Claude Code so the desktop input dialog appears; position it on the 4K monitor (dialog displays correctly there).
- Disconnect the external monitor (or trigger the dialog while viewing on the built-in laptop display).
- The dialog appears offset off the top of the laptop screen and cannot be read properly.
Root cause (observed)
~/Library/Application Support/Claude/window-state.json stores the position saved on the 4K display:
{"width":600,"height":600,"x":1620,"y":764,"displayBounds":{"x":0,"y":0,"width":3840,"height":2160},"isMaximized":false,"isFullScreen":false}
The stored displayBounds (3840×2160) no longer matches the built-in display (~1500×980 logical points), and the saved x/y coordinates fall outside the visible area. The app does not clamp or re-center the window when the display configuration changes.
Expected behavior
On restore, if the saved position/displayBounds don't match a currently attached display, the dialog should be clamped to visible screen bounds or re-centered on the active display.
What Should Happen?
Description
The desktop dialog that Claude Code shows for user input restores its saved window position without validating it against the current display configuration. The position is saved while a 4K external monitor (3840×2160) is connected; when the dialog later appears on the laptop's built-in screen, it is rendered offset off the top of the screen — partially unreadable and not repositionable easily.
Environment
- Claude Code version: 2.1.246
- OS: macOS 26.5.2 (build 25F84), Darwin 25.5.0
- Hardware: MacBook Pro (Mac16,8) built-in display + 4K external monitor (3840×2160)
Expected behavior
On restore, if the saved position/displayBounds don't match a currently attached display, the dialog should be clamped to visible screen bounds or re-centered on the active display.
Error Messages/Logs
## Root cause (observed)
`~/Library/Application Support/Claude/window-state.json` stores the position saved on the 4K display:
{"width":600,"height":600,"x":1620,"y":764,"displayBounds":{"x":0,"y":0,"width":3840,"height":2160},"isMaximized":false,"isFullScreen":false}
The stored `displayBounds` (3840×2160) no longer matches the built-in display (~1500×980 logical points), and the saved `x`/`y` coordinates fall outside the visible area. The app does not clamp or re-center the window when the display configuration changes.
Steps to Reproduce
- Connect a 4K external monitor to a MacBook Pro.
- Use Claude Code so the desktop input dialog appears; position it on the 4K monitor (dialog displays correctly there).
- Disconnect the external monitor (or trigger the dialog while viewing on the built-in laptop display).
- The dialog appears offset off the top of the laptop screen and cannot be read properly.
Claude Model
Other
Is this a regression?
No, this never worked
Last Working Version
_No response_
Claude Code Version
2.1.246
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
_No response_