fix: save history

This commit is contained in:
2026-02-05 01:14:44 +08:00
parent 3588c49d7d
commit 4b7a4eb36d
6 changed files with 51 additions and 13 deletions

View File

@@ -77,6 +77,7 @@ func Load() *Config {
}
v.SetDefault("host_name", defaultHostName)
v.SetDefault("id", uuid.New().String())
v.SetDefault("save_history", true)
v.SetConfigFile(configFile)
v.SetConfigType("json")
@@ -182,3 +183,16 @@ func (c *Config) GetSaveHistory() bool {
func (c *Config) GetVersion() string {
return Version
}
func (c *Config) SetWindowState(state WindowState) {
c.mu.Lock()
defer c.mu.Unlock()
c.WindowState = state
c.v.Set("window_state", state)
}
func (c *Config) GetWindowState() WindowState {
c.mu.RLock()
defer c.mu.RUnlock()
return c.WindowState
}