Simplify GUI settings and build flags
This commit is contained in:
@@ -13,6 +13,9 @@ import (
|
||||
type RuntimeState struct {
|
||||
mu sync.RWMutex
|
||||
DiscordMuted bool
|
||||
DiscordWindow string
|
||||
DiscordSource string
|
||||
DiscordAction string
|
||||
LastOCRText string
|
||||
LastTranslate string
|
||||
CurrentWorld string
|
||||
@@ -39,6 +42,27 @@ func SetDiscordMuted(v bool) {
|
||||
_ = persistRuntimeState()
|
||||
}
|
||||
|
||||
func SetDiscordWindow(v string) {
|
||||
runtimeState.mu.Lock()
|
||||
runtimeState.DiscordWindow = v
|
||||
runtimeState.mu.Unlock()
|
||||
_ = persistRuntimeState()
|
||||
}
|
||||
|
||||
func SetDiscordSource(v string) {
|
||||
runtimeState.mu.Lock()
|
||||
runtimeState.DiscordSource = v
|
||||
runtimeState.mu.Unlock()
|
||||
_ = persistRuntimeState()
|
||||
}
|
||||
|
||||
func SetDiscordAction(v string) {
|
||||
runtimeState.mu.Lock()
|
||||
runtimeState.DiscordAction = v
|
||||
runtimeState.mu.Unlock()
|
||||
_ = persistRuntimeState()
|
||||
}
|
||||
|
||||
func SetOCRText(v string) {
|
||||
runtimeState.mu.Lock()
|
||||
runtimeState.LastOCRText = v
|
||||
@@ -81,6 +105,9 @@ func persistRuntimeState() error {
|
||||
enc.SetIndent("", " ")
|
||||
return enc.Encode(map[string]any{
|
||||
"discord_muted": s.DiscordMuted,
|
||||
"discord_window": s.DiscordWindow,
|
||||
"discord_source": s.DiscordSource,
|
||||
"discord_action": s.DiscordAction,
|
||||
"ocr": s.LastOCRText,
|
||||
"translate": s.LastTranslate,
|
||||
"world": s.CurrentWorld,
|
||||
|
||||
Reference in New Issue
Block a user