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 """