From 82ed75cd0802c2938e388e2566d871a07f17b6cd Mon Sep 17 00:00:00 2001 From: Natalie Date: Tue, 30 Jun 2026 02:56:32 -0400 Subject: [PATCH] =?UTF-8?q?fix(display):=20=E2=9C=A8=20relocate=20a=20full?= =?UTF-8?q?screen=20VLC=20window=20when=20the=20output=20display=20changes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Changing the playback display did nothing while a video was playing: routeVlc set the window bounds and re-asserted fullscreen, but a fullscreen VLC window ignores `set bounds` and `set fullscreen mode to true` is a no-op when already true — so the video stayed on the original screen. Drop out of fullscreen first, move the now-normal window onto the target screen, then re-enter fullscreen there. Verified VLC AppleScript automation is reachable (get fullscreen mode → true) so this is the missing step, not a perms issue. Co-Authored-By: Claude Opus 4.8 (1M context) --- Sources/TVAnarchyCore/Display/DisplayService.swift | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Sources/TVAnarchyCore/Display/DisplayService.swift b/Sources/TVAnarchyCore/Display/DisplayService.swift index c2cb187..7d0c56d 100644 --- a/Sources/TVAnarchyCore/Display/DisplayService.swift +++ b/Sources/TVAnarchyCore/Display/DisplayService.swift @@ -46,13 +46,22 @@ public enum DisplayService { #if canImport(AppKit) guard let screen = screen(for: display) else { return true } let (l, t, r, b) = appleScriptBounds(for: screen) + // A fullscreen VLC window can't be relocated: `set bounds` is ignored while + // fullscreen and `set fullscreen mode to true` is a no-op when already true, + // so a live display switch would otherwise leave the video on the old screen. + // Drop out of fullscreen first, move the (now normal) window onto the target + // screen, then re-enter fullscreen there. let script = """ tell application "VLC" activate + try + set fullscreen mode to false + end try + delay 0.3 try set bounds of window 1 to {\(l), \(t), \(r), \(b)} end try - delay 0.4 + delay 0.3 set fullscreen mode to true end tell """