Add clipboard cleanup option for clipboard backend
This commit is contained in:
parent
1423e44008
commit
ccf968a410
9 changed files with 114 additions and 11 deletions
|
|
@ -38,6 +38,7 @@ class SttConfig:
|
|||
@dataclass
|
||||
class InjectionConfig:
|
||||
backend: str = DEFAULT_INJECTION_BACKEND
|
||||
remove_transcription_from_clipboard: bool = False
|
||||
|
||||
|
||||
@dataclass
|
||||
|
|
@ -115,6 +116,8 @@ def validate(cfg: Config) -> None:
|
|||
allowed = ", ".join(sorted(ALLOWED_INJECTION_BACKENDS))
|
||||
raise ValueError(f"injection.backend must be one of: {allowed}")
|
||||
cfg.injection.backend = backend
|
||||
if not isinstance(cfg.injection.remove_transcription_from_clipboard, bool):
|
||||
raise ValueError("injection.remove_transcription_from_clipboard must be boolean")
|
||||
|
||||
if not isinstance(cfg.ai.enabled, bool):
|
||||
raise ValueError("ai.enabled must be boolean")
|
||||
|
|
@ -180,6 +183,11 @@ def _from_dict(data: dict[str, Any], cfg: Config) -> Config:
|
|||
cfg.stt.device = _as_nonempty_str(stt["device"], "stt.device")
|
||||
if "backend" in injection:
|
||||
cfg.injection.backend = _as_nonempty_str(injection["backend"], "injection.backend")
|
||||
if "remove_transcription_from_clipboard" in injection:
|
||||
cfg.injection.remove_transcription_from_clipboard = _as_bool(
|
||||
injection["remove_transcription_from_clipboard"],
|
||||
"injection.remove_transcription_from_clipboard",
|
||||
)
|
||||
if "enabled" in ai:
|
||||
cfg.ai.enabled = _as_bool(ai["enabled"], "ai.enabled")
|
||||
if "replacements" in vocabulary:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue