From 11b33b08c3651f9d464c74263a598d53ff720a1b Mon Sep 17 00:00:00 2001 From: Anant Singhal <89266869+GithubAnant@users.noreply.github.com> Date: Fri, 24 Apr 2026 23:43:28 +0530 Subject: [PATCH 1/2] Fix NSHostingView frame origin to prevent content from disappearing on secondary displays --- leanring-buddy/OverlayWindow.swift | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/leanring-buddy/OverlayWindow.swift b/leanring-buddy/OverlayWindow.swift index 884ebcbf..ae6c7385 100644 --- a/leanring-buddy/OverlayWindow.swift +++ b/leanring-buddy/OverlayWindow.swift @@ -799,7 +799,12 @@ class OverlayWindowManager { ) let hostingView = NSHostingView(rootView: contentView) - hostingView.frame = screen.frame + // NSHostingView lives inside the overlay window's local coordinate + // system, so its origin must start at (0, 0). Using the global + // screen frame here pushes secondary-display content outside the + // window bounds, which makes the buddy disappear off the primary screen. + hostingView.frame = NSRect(origin: .zero, size: screen.frame.size) + hostingView.autoresizingMask = [.width, .height] window.contentView = hostingView overlayWindows.append(window) From 21f39fc8772e4471260b989b3e49866b37863c25 Mon Sep 17 00:00:00 2001 From: Anant Singhal <89266869+GithubAnant@users.noreply.github.com> Date: Fri, 24 Apr 2026 23:48:54 +0530 Subject: [PATCH 2/2] Fix NSHostingView frame origin to prevent content from disappearing on secondary displays --- leanring-buddy/OverlayWindow.swift | 4 ---- 1 file changed, 4 deletions(-) diff --git a/leanring-buddy/OverlayWindow.swift b/leanring-buddy/OverlayWindow.swift index ae6c7385..89867c44 100644 --- a/leanring-buddy/OverlayWindow.swift +++ b/leanring-buddy/OverlayWindow.swift @@ -799,10 +799,6 @@ class OverlayWindowManager { ) let hostingView = NSHostingView(rootView: contentView) - // NSHostingView lives inside the overlay window's local coordinate - // system, so its origin must start at (0, 0). Using the global - // screen frame here pushes secondary-display content outside the - // window bounds, which makes the buddy disappear off the primary screen. hostingView.frame = NSRect(origin: .zero, size: screen.frame.size) hostingView.autoresizingMask = [.width, .height] window.contentView = hostingView