Add "external script" paste method#638
Conversation
|
Can we make this a Linux only thing? |
|
Yes, but wouldn't it be useful to macos too? |
|
I would rather keep options fairly slim where possible. For me everything works more or less perfect on MacOS. It's my primary machine and I have very few if any issues |
|
@cjpais done |
|
Imo it would be nice to still be able to select one of the pre-existing paste methods but also run the script as well (for other use-cases other than just custom paste, like a custom post-transcription script that will run x y z commands). Lots of scripting possibilities here regardless of platform. If the user were to use this script to handle only pasting, they could set the paste method to none + add their script that will run after transcription with their own custom pasting method. Maybe this could be hidden inside "experimental features" instead? Just a thought! |
|
Hi @gabenasci, maybe we need 2 things:
|
|
@piec if you want this, could you rebase, I'll merge it as an option for Linux users |
|
OK, will do :) |
|
Hi @cjpais, rebased I also added the translations I knew but there are missing ones. |
|
Related to this previous comment #638 (comment) Are you interested by a PR for processing recognized text in an external command? |
|
@piec not at the moment, I'm mostly interested in PR's which are contributing to fixing the stability issues of the app. I will be putting a pause on most new features coming in. |
|
@cjpais Either this is not working on my computer or or I don't get how it's supposed to be used. I created a small test script #!/bin/bash
while IFS= read -r line; do
echo "$line" >> /tmp/test.log
doneand set the paste method to the external script but no |
|
@piec please take a look, I am unable to test this |
|
Hi @suuuehgi, is the script executable? Edit: Hmm also actually the text is passed as $1, not to stdin |
That was it. I just assumed it to read from stdin as there's no documentation about this feature whatsoever. Regarding stdin / $1 off the top of my head, I don't have any preferences on this. Arbitrarily long strings should use stdin but at the same time we're speaking about life transcriptions. That's probably a couple of sentences at max. |
|
The only documentation so far is the python example in a collapsible section in the text of the PR at the top of the page 🙂 |
Well hidden. 😅 I always overlooked that when skimming through it. |
|
Hi, I think this is a useful feature (for macos users as well).
The original need seems to be about processing the transcription rather that pasting it differently. Therefore I think this feature might be evolved/improved in the following way:
|
|
I agree, but if you are advanced enough you can use it on macOS by editing the settings file. This is not a setting for average users and it shouldn't be in the UI |
|
Hi I also thought making an additional PR to modify the code in order use stdin instead of the arg |
Add support for transcription hook - an executable script in app's data directory. If `transcription_hook` file exists, Handy runs it passing transcription text via stdin and uses script stdout as a transcription result. This approach is a flexible extension point for advanced users (which nowadays means with access to coding LLM) akin to git hooks. Here are some possible scenarios: * simple transcription modifications * a pipeline involving LLM processing, language detection and translation * custom paste method (as Handy does nothing if transcription is empty) * conditional processing based on the active application waiting for the input See related: * cjpais#168 * cjpais#739 * cjpais#638 * cjpais#455
Add support for transcription hook - an executable script in app's data directory. If `transcription_hook` file exists, Handy runs it passing transcription text via stdin and uses script stdout as a transcription result. This approach is a flexible extension point for advanced users (which nowadays means with access to coding LLM) akin to git hooks. Here are some possible scenarios: * simple transcription modifications * a pipeline involving LLM processing, language detection and translation * custom paste method (as Handy does nothing if transcription is empty) * conditional processing based on the active application waiting for the input See related: * cjpais#168 * cjpais#739 * cjpais#638 * cjpais#455
Add support for transcription hook - an executable script in app's data directory. If `transcription_hook` file exists, Handy runs it passing transcription text via stdin and uses script stdout as a transcription result. This approach is a flexible extension point for advanced users (which nowadays means with access to coding LLM) akin to git hooks. Here are some possible scenarios: * simple transcription modifications * a pipeline involving LLM processing, language detection and translation * custom paste method (as Handy does nothing if transcription is empty) * conditional processing based on the active application waiting for the input See related: * cjpais#168 * cjpais#162 * cjpais#916 * cjpais#911 * cjpais#834 * cjpais#847 * cjpais#833 * cjpais#662 * cjpais#601 * cjpais#335 * cjpais#162 * cjpais#739 * cjpais#638 * cjpais#455 * cjpais#157
Add support for transcription hook - an executable script in app's data directory. If `transcription_hook` file exists, Handy runs it passing transcription text via stdin and uses script stdout as a transcription result. This approach is a flexible extension point for advanced users (which nowadays means with access to coding LLM) akin to git hooks. Here are some possible scenarios: * simple transcription modifications * a pipeline involving LLM processing, language detection and translation * custom paste method (as Handy does nothing if transcription is empty) * conditional processing based on the active application waiting for the input See related: * cjpais#168 * cjpais#162 * cjpais#916 * cjpais#911 * cjpais#834 * cjpais#847 * cjpais#833 * cjpais#662 * cjpais#601 * cjpais#335 * cjpais#739 * cjpais#638 * cjpais#455 * cjpais#157
I've created #930 |
|
Hello @AlexanderYastrebov, I also did something like this but a bit differently, I will share it on my fork :) |
Add support for transcription hook - an executable script in app's data directory. If `transcription_hook` file exists, Handy runs it passing transcription text via stdin and uses script stdout as a transcription result. This approach is a flexible extension point for advanced users (which nowadays means with access to coding LLM) akin to git hooks. Here are some possible scenarios: * simple transcription modifications * a pipeline involving LLM processing, language detection and translation * custom paste method (as Handy does nothing if transcription is empty) * conditional processing based on the active application waiting for the input See related: * cjpais#168 * cjpais#162 * cjpais#916 * cjpais#911 * cjpais#834 * cjpais#847 * cjpais#833 * cjpais#662 * cjpais#601 * cjpais#335 * cjpais#739 * cjpais#638 * cjpais#455 * cjpais#157
Thanks for making Handy, I've only discovered a few days ago and it's awesome.
A few months ago I searched for something like this but couldn't find anything.
Before Submitting This PR
Please confirm you have done the following:
Human Written Description
Adds a new paste method that uses an external script.
That gives me the flexibility to post process the text as I want without adding complexity to Handy.
Examples:
Related Issues/Discussions
I'm noticing these after making the PR oops :)
But they complement each other:
Testing
I have tested it for a few days on an Arch Linux / xorg / i3 setup.
I think it should work on windows / macos too but cannot test on these platforms.
Simple external script example
Screenshots/Videos (if applicable)
AI Assistance
If AI was used: