Log config on startup

This commit is contained in:
Thales Maciel 2026-02-06 18:55:05 -03:00
parent cda89923ce
commit d124bfa24c

View file

@ -3,6 +3,7 @@ package main
import (
"bufio"
"context"
"encoding/json"
"flag"
"fmt"
"log"
@ -111,6 +112,7 @@ func main() {
go serveControl(logger, ln, d, &cfg, x, &mods, &keycode, reloadPath)
logger.Printf("ready (hotkey: %s)", cfg.Hotkey)
logConfig(logger, cfg, reloadPath)
if noTray {
go handleSignals(logger, d)
@ -163,6 +165,17 @@ func main() {
systray.Run(onReady, func() {})
}
func logConfig(logger *log.Logger, cfg config.Config, path string) {
safe := cfg
safe.AIAPIKey = ""
data, err := json.MarshalIndent(safe, "", " ")
if err != nil {
logger.Printf("config: <error: %v>", err)
return
}
logger.Printf("config (%s):\n%s", path, string(data))
}
func matchMods(state uint16, want uint16) bool {
masked := state & ^uint16(xproto.ModMaskLock|xproto.ModMask2)
return masked == want