Add interactive edit mode with floating popup
This commit is contained in:
parent
b42298b9b5
commit
99f07aef82
10 changed files with 1045 additions and 46 deletions
|
|
@ -10,6 +10,7 @@ from hotkey import split_hotkey
|
|||
|
||||
|
||||
DEFAULT_HOTKEY = "Cmd+m"
|
||||
DEFAULT_EDIT_HOTKEY = "Cmd+Shift+m"
|
||||
DEFAULT_STT_MODEL = "base"
|
||||
DEFAULT_STT_DEVICE = "cpu"
|
||||
DEFAULT_INJECTION_BACKEND = "clipboard"
|
||||
|
|
@ -20,6 +21,7 @@ WILDCARD_CHARS = set("*?[]{}")
|
|||
@dataclass
|
||||
class DaemonConfig:
|
||||
hotkey: str = DEFAULT_HOTKEY
|
||||
edit_hotkey: str = DEFAULT_EDIT_HOTKEY
|
||||
|
||||
|
||||
@dataclass
|
||||
|
|
@ -93,6 +95,19 @@ def validate(cfg: Config) -> None:
|
|||
split_hotkey(hotkey)
|
||||
except ValueError as exc:
|
||||
raise ValueError(f"daemon.hotkey is invalid: {exc}") from exc
|
||||
cfg.daemon.hotkey = hotkey
|
||||
|
||||
edit_hotkey = cfg.daemon.edit_hotkey.strip()
|
||||
if not edit_hotkey:
|
||||
raise ValueError("daemon.edit_hotkey cannot be empty")
|
||||
try:
|
||||
split_hotkey(edit_hotkey)
|
||||
except ValueError as exc:
|
||||
raise ValueError(f"daemon.edit_hotkey is invalid: {exc}") from exc
|
||||
cfg.daemon.edit_hotkey = edit_hotkey
|
||||
|
||||
if hotkey.casefold() == edit_hotkey.casefold():
|
||||
raise ValueError("daemon.hotkey and daemon.edit_hotkey must be different")
|
||||
|
||||
if isinstance(cfg.recording.input, bool):
|
||||
raise ValueError("recording.input cannot be boolean")
|
||||
|
|
@ -138,6 +153,8 @@ def _from_dict(data: dict[str, Any], cfg: Config) -> Config:
|
|||
|
||||
if "hotkey" in daemon:
|
||||
cfg.daemon.hotkey = _as_nonempty_str(daemon["hotkey"], "daemon.hotkey")
|
||||
if "edit_hotkey" in daemon:
|
||||
cfg.daemon.edit_hotkey = _as_nonempty_str(daemon["edit_hotkey"], "daemon.edit_hotkey")
|
||||
if "input" in recording:
|
||||
cfg.recording.input = _as_recording_input(recording["input"])
|
||||
if "model" in stt:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue