Open a different process to capture dictation in MacOs #9216
Closed
eduardoarandah
started this conversation in
Ideas
Replies: 7 comments 7 replies
|
Feel free to try.
|
1 reply
|
Should be pretty trivial
map f1 remote_control_script my_hear_script
Then in my_hear_script do something like:
1) Run hear and get text output
2) Use kitten @ send-text to send the text to the active kitty window
If you want to run it in its own window, something like
map f1 launch --allow-remote-control my_hear_script
```sh
#!/bin/sh
text=$(hear)
kitten @ send-text -m state:overlay_parent -- "$text"
```
make it more robust as you like.
|
1 reply
|
You can make various improvements. Assuming whatever program you are
runningin the terminal supports bracketed paste, you can use send-text
with --bracketed-paste and also use either --from-file or --stdin so
that the text is not interpreted for escapes.
Read kitten @ send-text --help
|
2 replies
|
You have not added --bracketed-paste=auto |
0 replies
|
And I tested the kitty parts of this, with: kitty --config=NONE -o 'map f1 launch --type=overlay --allow-remote-control sh -c "echo -n some text | kitten @ send-text --bracketed-paste=auto --match state:overlay_parent --stdin"'Pressing F1 causes "some text" to appear at the shell prompt as expected. |
2 replies
|
You cannot tee to /dev/tty and use kitten @ send-text which is
performing I/O on /dev/tty at the same time. Instead capture your output
from hear into a file or a shell variable or similar and *once it is
complete* use send-text on the result.
|
1 reply
|
That's because the single line mode in hear is implemented as outputting word then the escape code to clear the line the the next two words and so on. Dont use single line mode. Use normal mode and simply take the last line of output. Proof of concept: kitty --config=NONE -o 'map f1 launch --type=overlay --allow-remote-control zsh -c "echo Waiting for speech...; text=$(/opt/homebrew/bin/hear -d --locale=en-US --timeout 2 --punctuation | tee /dev/tty | tail -n1); echo Spoke: $text; echo Press enter to send to terminal; read; echo -n \"$text\" | kitten @ send-text --stdin --bracketed-paste=auto -m state:overlay_parent;"'You can make it a little nicer/more robust |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
In MacOs, dictation doesn't work because it's very specific to the os.
See: #3732 (comment)
However, dictation is a central part for some people vibing with LLMs or simply being forced to type less due to health issues.
What if instead of you could open another process, a simple modal triggering dictation and then capture the text?
The modal being a process that implements "cocoa view infrastructure", read: #3732 (comment)
dictation.mp4
All reactions