40 lines
1.0 KiB
Go
40 lines
1.0 KiB
Go
package model
|
|
|
|
type AppConfig struct {
|
|
Theme string `json:"theme"` // light | dark
|
|
FontSize int `json:"fontSize"` // 12-18
|
|
Scrollback int `json:"scrollback"` // 1000-10000
|
|
AutoLock int `json:"autoLock"` // minutes
|
|
Keepalive bool `json:"keepalive"`
|
|
CopyOnSelect bool `json:"copyOnSelect"`
|
|
BellEnabled bool `json:"bellEnabled"`
|
|
AutoReconnect bool `json:"autoReconnect"`
|
|
BlinkCursor bool `json:"blinkCursor"`
|
|
}
|
|
|
|
type ConfigStore struct {
|
|
Config AppConfig
|
|
}
|
|
|
|
func NewConfigStore() *ConfigStore {
|
|
return &ConfigStore{Config: defaultConfig()}
|
|
}
|
|
|
|
func (s *ConfigStore) Get() AppConfig { return s.Config }
|
|
|
|
func (s *ConfigStore) Update(cfg AppConfig) { s.Config = cfg }
|
|
|
|
func defaultConfig() AppConfig {
|
|
return AppConfig{
|
|
Theme: "light",
|
|
FontSize: 14,
|
|
Scrollback: 5000,
|
|
AutoLock: 5,
|
|
Keepalive: true,
|
|
CopyOnSelect: true,
|
|
BellEnabled: false,
|
|
AutoReconnect: true,
|
|
BlinkCursor: false,
|
|
}
|
|
}
|