Files

111 lines
3.6 KiB
Go

// Copyright (c) 2026 Storm Dragon
// Authors: Storm Dragon, Angus Kola
// SPDX-License-Identifier: GPL-3.0-or-later
// Package preferences implements the isolated GTK preferences process and its
// bounded, typed protocol. The UI never opens settings files or speech sockets.
package preferences
import (
"git.stormux.org/storm/cthulhu/internal/config"
"git.stormux.org/storm/cthulhu/internal/input"
"git.stormux.org/storm/cthulhu/internal/speech"
"git.stormux.org/storm/cthulhu/internal/tentacle"
)
type Values struct {
Pronunciations []config.PronunciationEntry
TextAttributes config.TextAttributeSettings
OCR config.OCRSettings
ProgressBar config.ProgressBarSettings
KeyboardLayout int
CthulhuModifierKeys []string
KeyBindings []input.BindingOverride
TimeFormat string
DateFormat string
EnableSound bool
EnableSpeech bool
SpeechHistoryLimit int
SpeechVerbosityLevel int
SayAllStyle string
EnableBraille bool
EnableContractedBraille bool
BrailleContractionTable string
Braille config.BrailleOptions
SoundVolume float64
SoundSink string
SoundTheme string
PlaySoundForRole bool
PlaySoundForState bool
PlaySoundForPositionInSet bool
SpatializeObjectSounds bool
RoleSoundPresentation string
EnableKeyEcho bool
EnableAlphabeticKeys bool
EnableNumericKeys bool
EnablePunctuationKeys bool
EnableSpace bool
EnableModifierKeys bool
EnableFunctionKeys bool
EnableActionKeys bool
EnableNavigationKeys bool
EnableDiacriticalKeys bool
EnableEchoByCharacter bool
EnableEchoByWord bool
EnableEchoBySentence bool
UseCustomEchoVoice bool
UseCustomEchoSpeechServer bool
UseCustomEchoForKey bool
UseCustomEchoForCharacter bool
UseCustomEchoForWord bool
UseCustomEchoForSentence bool
EchoVoice config.Voice
EchoSpeechServer string
Rate *float64
Pitch *float64
Volume *float64
SpeechServerFactory string
HardwareSpeechDevice string
HardwareSpeechBaudRate int
SpeechOutputModule string
SpeechVoiceFamily *config.VoiceFamily
UppercaseVoice config.Voice
HyperlinkVoice config.Voice
SystemVoice config.Voice
VoiceType string // Preview selection; never persisted as reader state.
Punctuation int
Capitalization string
Reading config.ReadingSettings
SpeakDescription bool
}
type Request struct {
Tentacle *tentacle.ManagementRequest
Application string
Values Values
Save bool
Close bool
// Preview applies the default voice controls to the running speech
// backend without committing session or persistent settings.
Preview bool
// Cancel restores the last committed settings after a live preview.
Cancel bool
}
type Response struct {
Tentacles *tentacle.Snapshot `json:",omitempty"`
ChooseApplication bool
Catalog speech.Catalog
CatalogPending bool // More catalog parts follow before the UI can initialize.
Application string
Present bool
Close bool
Values Values
CanSave bool
Message string
Preview bool
// Accepted distinguishes committed session values from rejected drafts.
Accepted bool
}