diff --git a/LEEME.md b/LEEME.md index dd81837..5637f68 100644 --- a/LEEME.md +++ b/LEEME.md @@ -10,12 +10,10 @@ Dependencias: Ubuntu ``` -sudo apt install xdotool pip install --user vosk ``` Arch ``` -sudo pacman -S xdotool pip install --user vosk ``` diff --git a/extension/ZazTalk2Me_v0.1.0.oxt b/extension/ZazTalk2Me_v0.1.0.oxt index 8cc0270..f6bb9fd 100644 Binary files a/extension/ZazTalk2Me_v0.1.0.oxt and b/extension/ZazTalk2Me_v0.1.0.oxt differ diff --git a/source/ZazTalk2Me.py b/source/ZazTalk2Me.py index 9c30a24..54c42d8 100644 --- a/source/ZazTalk2Me.py +++ b/source/ZazTalk2Me.py @@ -20,12 +20,12 @@ class ZazTalk2Me(unohelper.Base, XJobExecutor): path_ext = app.paths.from_id(ID_EXTENSION) path_model = app.paths.join(path_ext, 'model') nd.main_begin(vosk_model_dir=path_model, config_override=None) - app.info('Start') return def trigger(self, args): if args=='start': self._start() + app.info('Start') elif args=='end': nd.main_end() app.info('End') diff --git a/source/pythonpath/nerd_dictation.py b/source/pythonpath/nerd_dictation.py index 1d095b9..487e1a7 100755 --- a/source/pythonpath/nerd_dictation.py +++ b/source/pythonpath/nerd_dictation.py @@ -22,7 +22,7 @@ This is a utility that activates text to speech in Linux. While it could use any system currently it uses the VOSK-API. """ - +import easymacro as app # See: `hacking.rst` for developer notes. # All built in modules. @@ -68,7 +68,15 @@ def run_xdotool(subcommand: str, payload: List[str]) -> None: "--clearmodifiers", ] + payload try: - subprocess.check_output(cmd) + # ~ print(cmd) + # ~ type or key + rango = app.selection.goto_end() + if subcommand == 'type': + word = payload[-1] + rango.string = word + else: + rango.go_left(count=len(payload), expand=True).string = '' + # ~ subprocess.check_output(cmd) except FileNotFoundError as ex: print("Command {!r} not found: {!s}".format(cmd_base, ex)) sys.exit(1) @@ -762,6 +770,8 @@ def text_from_vosk_pipe( sys.stderr.write("--input %r not supported.\n" % input_method) sys.exit(1) + # ~ print(cmd) + # ~ ('parec', '--record', '--rate=44100', '--channels=1', '--format=s16ne', '--latency=10') ps = subprocess.Popen(cmd, stdout=subprocess.PIPE) stdout = ps.stdout