Add seconds config

This commit is contained in:
2026-02-02 20:57:41 +02:00
parent d1307a75b9
commit b309ccd9cd
5 changed files with 42 additions and 3 deletions

View File

@@ -200,6 +200,7 @@ type Settings struct {
BlinkOffMs int
ColorClock string
ColorAlarm string
ShowSeconds bool
}
func DefaultSettings() Settings {
@@ -211,6 +212,7 @@ func DefaultSettings() Settings {
BlinkOffMs: 500,
ColorClock: "#00FF88",
ColorAlarm: "#FF4444",
ShowSeconds: true,
}
}
@@ -223,6 +225,7 @@ func (s *Store) LoadSettings() Settings {
cfg.BlinkOffMs = s.getSettingInt("blink_off_ms", cfg.BlinkOffMs)
cfg.ColorClock = s.GetSetting("color_clock", cfg.ColorClock)
cfg.ColorAlarm = s.GetSetting("color_alarm", cfg.ColorAlarm)
cfg.ShowSeconds = s.GetSetting("show_seconds", "true") == "true"
return cfg
}
@@ -235,6 +238,7 @@ func (s *Store) SaveSettings(cfg Settings) error {
"blink_off_ms": fmt.Sprintf("%d", cfg.BlinkOffMs),
"color_clock": cfg.ColorClock,
"color_alarm": cfg.ColorAlarm,
"show_seconds": fmt.Sprintf("%t", cfg.ShowSeconds),
}
for k, v := range pairs {
if err := s.SetSetting(k, v); err != nil {