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:
@@ -84,6 +84,21 @@ layouts:
|
||||
|
||||
active_layout: quad
|
||||
|
||||
# On-screen clock overlay: a small always-on-top window showing the local time,
|
||||
# drawn as white text with a black outline so it stays legible over both bright
|
||||
# (day) and dark (night) camera scenes. The time is computed in the given
|
||||
# timezone (DST handled automatically), independent of the host clock's zone.
|
||||
clock:
|
||||
enabled: true
|
||||
timezone: America/Denver # IANA name; "Local" uses the system zone
|
||||
format: "15:04:05" # Go time layout (24-hour w/ seconds). Others:
|
||||
# "3:04:05 PM" · "Mon Jan 2 15:04"
|
||||
corner: bottom-right # bottom-right | bottom-left | top-right | top-left
|
||||
font_size: 44 # glyph height in px
|
||||
width: 300 # overlay window size in px
|
||||
height: 72
|
||||
margin: 24 # gap from the screen edges in px
|
||||
|
||||
# Re-sync the active layout from its linked UniFi Protect live view every N
|
||||
# seconds (0 = off). Layouts created by `views import` carry a `protect_view:`
|
||||
# and are re-synced when this is set. Requires the controller password at
|
||||
|
||||
Reference in New Issue
Block a user