feat: add --overlay-font-family option for caption font customization

Allow users to specify a custom font family for the overlay captions via
a new --overlay-font-family flag, defaulting to "Sans". Validation
ensures the font family is not empty. Updated README, config, and tests.
This commit is contained in:
2026-07-16 18:09:09 +03:00
parent 192666dd43
commit 2f5ca41ac3
4 changed files with 37 additions and 6 deletions
+7
View File
@@ -4,11 +4,13 @@ package config
import (
"errors"
"flag"
"strings"
"time"
)
const (
DefaultModelsDir = "models"
DefaultOverlayFontFamily = "Sans"
MinimumOverlayFinalLifetime = 3 * time.Second
)
@@ -60,6 +62,7 @@ type OverlaySettings struct {
Backend OverlayBackend
Opacity float64
FontSize int
FontFamily string
BottomMargin int
MaxWidth int
Monitor string
@@ -88,6 +91,7 @@ func ParseDesktop() DesktopSettings {
flags.StringVar(&backend, "overlay-backend", "auto", "display backend: auto, wayland, or x11")
flags.Float64Var(&desktop.Overlay.Opacity, "overlay-opacity", 0.90, "caption background opacity from 0 to 1")
flags.IntVar(&desktop.Overlay.FontSize, "overlay-font-size", 28, "caption font size in logical pixels")
flags.StringVar(&desktop.Overlay.FontFamily, "overlay-font-family", DefaultOverlayFontFamily, "caption font family")
flags.IntVar(&desktop.Overlay.BottomMargin, "overlay-bottom-margin", 100, "distance from the monitor bottom in logical pixels")
flags.IntVar(&desktop.Overlay.MaxWidth, "overlay-max-width", 1200, "fixed caption width in logical pixels before the monitor safety cap")
flags.StringVar(&desktop.Overlay.Monitor, "overlay-monitor", "auto", "monitor selection: auto, numeric index, or connector name")
@@ -129,6 +133,9 @@ func (s DesktopSettings) Validate() error {
if s.Overlay.FontSize <= 0 {
return errors.New("--overlay-font-size must be positive")
}
if strings.TrimSpace(s.Overlay.FontFamily) == "" {
return errors.New("--overlay-font-family cannot be empty")
}
if s.Overlay.BottomMargin < 0 {
return errors.New("--overlay-bottom-margin cannot be negative")
}