fix(display): ✨ relocate a fullscreen VLC window when the output display changes
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) <noreply@anthropic.com>
This commit is contained in:
parent
d06a25da2c
commit
82ed75cd08
1 changed files with 10 additions and 1 deletions
|
|
@ -46,13 +46,22 @@ public enum DisplayService {
|
||||||
#if canImport(AppKit)
|
#if canImport(AppKit)
|
||||||
guard let screen = screen(for: display) else { return true }
|
guard let screen = screen(for: display) else { return true }
|
||||||
let (l, t, r, b) = appleScriptBounds(for: screen)
|
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 = """
|
let script = """
|
||||||
tell application "VLC"
|
tell application "VLC"
|
||||||
activate
|
activate
|
||||||
|
try
|
||||||
|
set fullscreen mode to false
|
||||||
|
end try
|
||||||
|
delay 0.3
|
||||||
try
|
try
|
||||||
set bounds of window 1 to {\(l), \(t), \(r), \(b)}
|
set bounds of window 1 to {\(l), \(t), \(r), \(b)}
|
||||||
end try
|
end try
|
||||||
delay 0.4
|
delay 0.3
|
||||||
set fullscreen mode to true
|
set fullscreen mode to true
|
||||||
end tell
|
end tell
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue