Files

197 lines
10 KiB
Go

// Cthulhu screen reader.
// Copyright (c) 2026 Storm Dragon
// Authors: Storm Dragon, Angus Kola
//
// This program is free software: you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by the Free
// Software Foundation, either version 3 of the License, or (at your option)
// any later version.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
// more details.
//
// You should have received a copy of the GNU General Public License along with
// this program. If not, see <https://www.gnu.org/licenses/gpl-3.0.html>.
package config
import (
"git.stormux.org/storm/cthulhu/internal/input"
)
const CurrentSchemaVersion = 2
type writableDocument struct {
SchemaVersion int `toml:"schema-version"`
ActiveProfile string `toml:"active-profile"`
Profiles map[string]writableProfile `toml:"profiles"`
Applications map[string]string `toml:"applications,omitempty"`
}
// Profiles are patches over built-in defaults. The writer emits a complete
// active profile so saved behavior remains stable if defaults later change.
type writableProfile struct {
OCR writableOCR `toml:"ocr"`
ProgressBar writableProgressBar `toml:"progress-bar"`
Presentation writablePresentation `toml:"presentation"`
Speech writableSpeech `toml:"speech"`
Braille writableBraille `toml:"braille"`
Sound writableSound `toml:"sound"`
Keyboard writableKeyboard `toml:"keyboard"`
KeyEcho writableKeyEcho `toml:"key-echo"`
}
type writableOCR struct {
Language *string `toml:"language,omitempty"`
Layout *int `toml:"layout,omitempty"`
Scale *int `toml:"scale,omitempty"`
Grayscale *bool `toml:"grayscale,omitempty"`
Invert *bool `toml:"invert,omitempty"`
BlackWhite *bool `toml:"black-white,omitempty"`
Threshold *int `toml:"threshold,omitempty"`
AutoRefresh *bool `toml:"auto-refresh,omitempty"`
RefreshInterval *int `toml:"refresh-interval-ms,omitempty"`
ConfirmClick *bool `toml:"confirm-click,omitempty"`
CopyFirstResult *bool `toml:"copy-first-result,omitempty"`
AutoReadAll *bool `toml:"auto-read-all,omitempty"`
}
type writableProgressBar struct {
OutputMode *string `toml:"output-mode,omitempty"`
ReportBackground *bool `toml:"report-background,omitempty"`
BeepPercentageInterval *int `toml:"beep-percentage-interval,omitempty"`
SpeechPercentageInterval *int `toml:"speech-percentage-interval,omitempty"`
}
type writablePresentation struct {
TimeFormat *string `toml:"time-format,omitempty"`
DateFormat *string `toml:"date-format,omitempty"`
SpeakDescription *bool `toml:"speak-description,omitempty"`
SpeechVerbosityLevel *int `toml:"speech-verbosity-level,omitempty"`
SayAllStyle *string `toml:"say-all-style,omitempty"`
Reading writableReading `toml:"reading,omitempty"`
Pronunciations *[]PronunciationEntry `toml:"pronunciations,omitempty"`
TextAttributes writableTextAttributes `toml:"text-attributes,omitempty"`
}
type writableTextAttributes struct {
Choices *[]TextAttributeChoice `toml:"choices,omitempty"`
Indicator *int `toml:"indicator,omitempty"`
}
type writableReading struct {
AutomaticallyReadClipboardChanges *bool `toml:"automatically-read-clipboard-changes,omitempty"`
AutomaticallyReadTitleChanges *bool `toml:"automatically-read-title-changes,omitempty"`
EnablePauseBreaks *bool `toml:"enable-pause-breaks,omitempty"`
SpeakNumbersAsDigits *bool `toml:"speak-numbers-as-digits,omitempty"`
SpeakMultiCaseStringsAsWords *bool `toml:"speak-multicase-strings-as-words,omitempty"`
EnableIndentation *bool `toml:"enable-indentation,omitempty"`
IndentationPresentationMode *string `toml:"indentation-presentation-mode,omitempty"`
OnlySpeakDisplayedText *bool `toml:"only-speak-displayed-text,omitempty"`
SpeakBlankLines *bool `toml:"speak-blank-lines,omitempty"`
EnableMnemonicSpeaking *bool `toml:"enable-mnemonic-speaking,omitempty"`
EnablePositionSpeaking *bool `toml:"enable-position-speaking,omitempty"`
EnableTutorialMessages *bool `toml:"enable-tutorial-messages,omitempty"`
MessagesAreDetailed *bool `toml:"messages-are-detailed,omitempty"`
UseColorNames *bool `toml:"use-color-names,omitempty"`
PresentTooltips *bool `toml:"present-tooltips,omitempty"`
EnableMouseReview *bool `toml:"enable-mouse-review,omitempty"`
SpeakMisspelledIndicator *bool `toml:"speak-misspelled-indicator,omitempty"`
SpeakContextBlockquote *bool `toml:"speak-context-blockquote,omitempty"`
SpeakContextList *bool `toml:"speak-context-list,omitempty"`
SpeakContextTable *bool `toml:"speak-context-table,omitempty"`
SpeakContextPanel *bool `toml:"speak-context-panel,omitempty"`
SpeakContextLandmark *bool `toml:"speak-context-landmark,omitempty"`
SpeakContextNonLandmarkForm *bool `toml:"speak-context-non-landmark-form,omitempty"`
SayAllContextBlockquote *bool `toml:"say-all-context-blockquote,omitempty"`
SayAllContextList *bool `toml:"say-all-context-list,omitempty"`
SayAllContextTable *bool `toml:"say-all-context-table,omitempty"`
SayAllContextPanel *bool `toml:"say-all-context-panel,omitempty"`
SayAllContextLandmark *bool `toml:"say-all-context-landmark,omitempty"`
SayAllContextNonLandmarkForm *bool `toml:"say-all-context-non-landmark-form,omitempty"`
ReadFullRowInGUITable *bool `toml:"read-full-row-in-gui-table,omitempty"`
ReadFullRowInDocumentTable *bool `toml:"read-full-row-in-document-table,omitempty"`
ReadFullRowInSpreadSheet *bool `toml:"read-full-row-in-spreadsheet,omitempty"`
}
type writableSpeech struct {
HardwareDevice *string `toml:"hardware-device,omitempty"`
HardwareBaudRate *int `toml:"hardware-baud-rate,omitempty"`
OutputModule *string `toml:"output-module,omitempty"`
Enabled *bool `toml:"enabled,omitempty"`
HistoryLimit *int `toml:"history-limit,omitempty"`
ServerFactory *string `toml:"server-factory,omitempty"`
Punctuation *int `toml:"punctuation-style,omitempty"`
Capitalization *string `toml:"capitalization-style,omitempty"`
DefaultVoice *Voice `toml:"default-voice,omitempty"`
UppercaseVoice *Voice `toml:"uppercase-voice,omitempty"`
HyperlinkVoice *Voice `toml:"hyperlink-voice,omitempty"`
SystemVoice *Voice `toml:"system-voice,omitempty"`
}
type writableBraille struct {
Enabled *bool `toml:"enabled,omitempty"`
Contracted *bool `toml:"contracted,omitempty"`
ContractionTable *string `toml:"contraction-table,omitempty"`
AbbreviateRoles *bool `toml:"abbreviate-roles,omitempty"`
DisableEOL *bool `toml:"disable-eol,omitempty"`
WordWrap *bool `toml:"word-wrap,omitempty"`
Verbosity *int `toml:"verbosity,omitempty"`
SelectionIndicator *int `toml:"selection-indicator,omitempty"`
LinkIndicator *int `toml:"link-indicator,omitempty"`
FlashMessages *bool `toml:"flash-messages,omitempty"`
FlashTime *int `toml:"flash-time,omitempty"`
FlashPersistent *bool `toml:"flash-persistent,omitempty"`
FlashDetailed *bool `toml:"flash-detailed,omitempty"`
}
type writableSound struct {
// Retain recognition of existing version 2 fields. They are no longer used
// or emitted when saving settings; progress output has its own policy.
PlayForValue *bool `toml:"play-for-value,omitempty"`
BeepProgressUpdates *bool `toml:"beep-progress-updates,omitempty"`
ProgressBeepInterval *int `toml:"progress-beep-interval,omitempty"`
Enabled *bool `toml:"enabled,omitempty"`
Volume *float64 `toml:"volume,omitempty"`
Sink *string `toml:"sink,omitempty"`
Theme *string `toml:"theme,omitempty"`
PlayForRole *bool `toml:"play-for-role,omitempty"`
PlayForState *bool `toml:"play-for-state,omitempty"`
PlayForPosition *bool `toml:"play-for-position,omitempty"`
Spatialize *bool `toml:"spatialize,omitempty"`
RolePresentationStrategy *string `toml:"role-presentation-strategy,omitempty"`
}
type writableKeyboard struct {
Bindings *[]input.BindingOverride `toml:"bindings,omitempty"`
Layout *int `toml:"layout,omitempty"`
ScreenReaderKeys *[]string `toml:"screen-reader-keys,omitempty"`
}
type writableKeyEcho struct {
UseCustomEchoVoice *bool `toml:"custom-voice,omitempty"`
UseCustomEchoSpeechServer *bool `toml:"custom-speech-server,omitempty"`
UseCustomEchoForKey *bool `toml:"custom-for-key,omitempty"`
UseCustomEchoForCharacter *bool `toml:"custom-for-character,omitempty"`
UseCustomEchoForWord *bool `toml:"custom-for-word,omitempty"`
UseCustomEchoForSentence *bool `toml:"custom-for-sentence,omitempty"`
EchoVoice *Voice `toml:"voice,omitempty"`
EchoSpeechServer *string `toml:"speech-server,omitempty"`
Enabled *bool `toml:"enabled,omitempty"`
ByCharacter *bool `toml:"by-character,omitempty"`
ByWord *bool `toml:"by-word,omitempty"`
BySentence *bool `toml:"by-sentence,omitempty"`
Alphabetic *bool `toml:"alphabetic,omitempty"`
Numeric *bool `toml:"numeric,omitempty"`
Punctuation *bool `toml:"punctuation,omitempty"`
Space *bool `toml:"space,omitempty"`
Modifiers *bool `toml:"modifiers,omitempty"`
FunctionKeys *bool `toml:"function-keys,omitempty"`
ActionKeys *bool `toml:"action-keys,omitempty"`
NavigationKeys *bool `toml:"navigation-keys,omitempty"`
Diacritical *bool `toml:"diacritical,omitempty"`
}