97 lines
3.0 KiB
Go
97 lines
3.0 KiB
Go
// Fenrir console screen reader.
|
|
// Copyright (c) 2026 Storm Dragon
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
//
|
|
// 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 app joins the console, input, reading, and speech services.
|
|
package app
|
|
|
|
import (
|
|
"context"
|
|
|
|
"git.stormux.org/storm/fenrir/internal/clipboard"
|
|
"git.stormux.org/storm/fenrir/internal/command"
|
|
"git.stormux.org/storm/fenrir/internal/config"
|
|
"git.stormux.org/storm/fenrir/internal/control"
|
|
"git.stormux.org/storm/fenrir/internal/input"
|
|
"git.stormux.org/storm/fenrir/internal/preferences"
|
|
"git.stormux.org/storm/fenrir/internal/presentation"
|
|
"git.stormux.org/storm/fenrir/internal/punctuation"
|
|
"git.stormux.org/storm/fenrir/internal/screen"
|
|
"git.stormux.org/storm/fenrir/internal/scripts"
|
|
"git.stormux.org/storm/fenrir/internal/speech"
|
|
"git.stormux.org/storm/fenrir/internal/spellcheck"
|
|
)
|
|
|
|
type Source interface {
|
|
Events() <-chan error
|
|
State() (int, bool, bool, error)
|
|
Read() (screen.Snapshot, error)
|
|
}
|
|
|
|
type Keyboards interface {
|
|
Events() <-chan error
|
|
Poll(bool, bool, func(input.Decision)) error
|
|
Scan() error
|
|
Pass_next()
|
|
Capture(bool) error
|
|
Update_modifiers([]string, []string) (bool, error)
|
|
Close() error
|
|
}
|
|
|
|
type Speaker interface {
|
|
Say(string)
|
|
Say_after(string, func(context.Context))
|
|
Say_with_pitch(text string, pitch int)
|
|
Configure(speech.Parameters)
|
|
Interrupt()
|
|
Toggle_mute() bool
|
|
Errors() <-chan error
|
|
Close()
|
|
}
|
|
|
|
type SoundPlayer interface {
|
|
// Play reports whether the cue was accepted, so unavailable cues use speech.
|
|
Play(presentation.Cue) bool
|
|
Play_wait(context.Context, presentation.Cue) error
|
|
Play_progress(float64) bool
|
|
Play_indentation(int) bool
|
|
Discard_progress()
|
|
Clear_progress()
|
|
Set_volume(float64)
|
|
Errors() <-chan error
|
|
}
|
|
|
|
type RunOptions struct {
|
|
Ready func() error
|
|
Bindings []input.Binding
|
|
Punctuation *punctuation.Processor
|
|
Settings config.Settings
|
|
EffectiveSpeech *config.Speech
|
|
Sounds SoundPlayer
|
|
ConfigPath string
|
|
Clipboard ClipboardTransfers
|
|
ClipboardHistory *clipboard.Persistence
|
|
SettingsChoices func(config.Settings) preferences.Discovery
|
|
Scripts map[command.ID]scripts.Script
|
|
ScriptRunner *scripts.Runner
|
|
Remote *control.Server
|
|
TerminalMode bool
|
|
Spellcheck *spellcheck.Service
|
|
|
|
SharedNotifications bool
|
|
NotificationNamespace string // Private IPC namespace for native fixtures.
|
|
}
|