Fix mpv tile overlap portably; add make install/deploy

mpv 0.35 rejects --auto-window-resize, which crash-looped every player.
Drop that flag and re-assert each tile geometry on a 1s timer in the
daemon, overriding mpv auto-resize on any mpv version.

Add make install (auto-sudo, native build + copy to /usr/local/bin)
and make deploy (install + restart the kiosk getty unit).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Levi Woodard
2026-07-01 19:36:36 -05:00
parent ca74ba0070
commit 0fb731a71e
3 changed files with 52 additions and 19 deletions

View File

@@ -153,27 +153,35 @@ func (d *Daemon) applyLayout(ctx context.Context, name string) error {
return nil
}
// placeWhenReady waits for the mpv window to map then tiles it, retrying while
// the layout is active (Supervise may relaunch mpv with a new pid).
// placeWhenReady waits for the mpv window to map, tiles it, then keeps
// re-asserting its geometry on a timer. The re-assertion matters because mpv
// resizes its own window to the camera's native resolution when the stream
// loads (and mpv 0.35 has no flag to disable that); re-issuing the sway
// resize snaps the window back into its cell, portably across mpv versions.
func (d *Daemon) placeWhenReady(ctx context.Context, p *player.Player, rect compositor.Rect) {
var lastPID int
ticker := time.NewTicker(500 * time.Millisecond)
var readyPID int
ticker := time.NewTicker(1 * time.Second)
defer ticker.Stop()
for {
if ctx.Err() != nil {
return
}
pid := p.PID()
if pid != 0 && pid != lastPID {
if err := d.comp.WaitForWindow(ctx, pid, 15*time.Second); err == nil {
if err := d.comp.Place(ctx, pid, rect); err != nil {
d.log.Warn("place failed", "slot", p.Slot, "err", err)
} else {
lastPID = pid
d.log.Debug("window placed", "slot", p.Slot, "pid", pid, "rect", rect)
if pid != 0 {
// New process: wait for its window to map before positioning.
if pid != readyPID {
if err := d.comp.WaitForWindow(ctx, pid, 15*time.Second); err != nil {
goto wait
}
readyPID = pid
d.log.Debug("window mapped", "slot", p.Slot, "pid", pid, "rect", rect)
}
// Re-assert geometry every tick to override mpv's auto-resize.
if err := d.comp.Place(ctx, pid, rect); err != nil {
d.log.Debug("place failed", "slot", p.Slot, "err", err)
}
}
wait:
select {
case <-ctx.Done():
return