Add on-screen clock overlay (outlined text, configurable corner/timezone)
A small always-on-top mpv window renders the local time in a screen corner. Implementation notes: - Transparent lavfi canvas (color=...@0.0, --alpha=yes) so the camera video shows through; no new dependencies. If the compositor can't do alpha it degrades to a dark backing, still legible. - Time drawn as an ASS osd-overlay pushed over mpv IPC once a second: white fill + black outline (\bord), so it reads on both bright (day) and dark (night) scenes without sampling the picture. Formatting the text in Go avoids any filtergraph escaping. - Time computed with time.LoadLocation against a configured IANA zone (default "Local"), so it's correct regardless of the host clock's zone and handles DST. A bad zone name fails at startup. - Managed on the daemon's own context (survives layout switches); the daemon keeps it positioned and raised above camera tiles. ensureClock is a no-op when the clock config + resolution are unchanged, so a reload never disturbs it. Config: new `clock` section (enabled, timezone, format, corner, font_size, width, height, margin) with defaults and corner validation. Documented in README and config.example (shipped enabled, America/Denver, 24-hour w/ seconds). Tests cover corner geometry. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -245,7 +245,14 @@ func (p *Player) Stop() {
|
||||
// Command sends a JSON IPC command to mpv and returns the decoded reply. Used
|
||||
// for health probes and live property changes.
|
||||
func (p *Player) Command(args ...any) (map[string]any, error) {
|
||||
conn, err := net.DialTimeout("unix", p.ipcPath, 2*time.Second)
|
||||
return ipcCommand(p.ipcPath, args...)
|
||||
}
|
||||
|
||||
// ipcCommand sends one JSON command to an mpv IPC socket and returns the
|
||||
// decoded reply. Shared by Player (health probes, reload) and Clock (overlay
|
||||
// updates).
|
||||
func ipcCommand(path string, args ...any) (map[string]any, error) {
|
||||
conn, err := net.DialTimeout("unix", path, 2*time.Second)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user