Log config on startup
This commit is contained in:
parent
cda89923ce
commit
d124bfa24c
1 changed files with 13 additions and 0 deletions
|
|
@ -3,6 +3,7 @@ package main
|
||||||
import (
|
import (
|
||||||
"bufio"
|
"bufio"
|
||||||
"context"
|
"context"
|
||||||
|
"encoding/json"
|
||||||
"flag"
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
|
|
@ -111,6 +112,7 @@ func main() {
|
||||||
go serveControl(logger, ln, d, &cfg, x, &mods, &keycode, reloadPath)
|
go serveControl(logger, ln, d, &cfg, x, &mods, &keycode, reloadPath)
|
||||||
|
|
||||||
logger.Printf("ready (hotkey: %s)", cfg.Hotkey)
|
logger.Printf("ready (hotkey: %s)", cfg.Hotkey)
|
||||||
|
logConfig(logger, cfg, reloadPath)
|
||||||
|
|
||||||
if noTray {
|
if noTray {
|
||||||
go handleSignals(logger, d)
|
go handleSignals(logger, d)
|
||||||
|
|
@ -163,6 +165,17 @@ func main() {
|
||||||
systray.Run(onReady, func() {})
|
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 {
|
func matchMods(state uint16, want uint16) bool {
|
||||||
masked := state & ^uint16(xproto.ModMaskLock|xproto.ModMask2)
|
masked := state & ^uint16(xproto.ModMaskLock|xproto.ModMask2)
|
||||||
return masked == want
|
return masked == want
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue