feat: support ${selected} placeholder in post-processing prompts#1610
Open
shuwarida wants to merge 1 commit into
Open
feat: support ${selected} placeholder in post-processing prompts#1610shuwarida wants to merge 1 commit into
shuwarida wants to merge 1 commit into
Conversation
Lets a prompt template reference the text currently selected in the
active app, captured by simulating Ctrl+C/Cmd+C and restoring the
clipboard afterwards. Only triggers the copy simulation when a prompt
actually contains ${selected}, to avoid touching the clipboard otherwise.
Author
|
Here's a demo showing this in action 2026-07-06.00.51.45.mov |
|
All new features are unveiled in discussions with clear descriptions. Currently, the project's goal is to bring it to the most stable state possible before version 1.0, where all current features will work flawlessly across all operating systems. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Before Submitting This PR
Please confirm you have done the following:
If this is a feature or change that was previously closed/rejected:
Human Written Description
I noticed that Handy's post-processing is basically already a voice assistant that runs over text — it just never had access to anything except the freshly dictated transcript (
${output}). I wanted to use it for things beyond dictation cleanup: rewording a message, translating a paragraph, turning a chunk of text into a checklist — all by voice, without switching to typing. The missing piece was simple: give the prompt access to whatever text is currently selected in the active app, not just what was just spoken. So I added${selected}as a second placeholder alongside${output}, reusing the exact same prompt/provider infrastructure that's already there.To show what this actually unlocks, here's the prompt I've been using myself as a post-processing template — with it saved, dictation with nothing selected gets cleaned up as usual, but highlighting any text and speaking a command ("make it shorter", "translate this", "list the problems here") edits or transforms the selection directly:
Related Issues/Discussions
Related to #1523, which was closed with "feature requests are meant to be discussions, not issues" rather than rejected on merits. That request asked for a dedicated hotkey + voice-instruction flow to transform selected text in place. This PR takes a smaller, incremental step toward the same underlying need: it adds a
${selected}placeholder usable in the existing post-processing prompt templates, so a saved prompt can reference the text currently selected in the active app alongside${output}. It reuses the existing prompt/provider infrastructure rather than adding new hotkeys or UI.Discussion: none opened yet — happy to open one if maintainers would prefer that before review.
Community Feedback
No dedicated discussion thread yet for this specific
${selected}approach. Surfacing it as a PR directly since it's a small, additive change to the existing prompt system (no new hotkeys, no new settings surface) rather than a net-new feature area.Testing
cargo checkpasses.${selected}, selected text in another app, ran dictation with post-processing enabled — captured selection was correctly substituted into the prompt sent to the LLM.${selected}behave exactly as before (no clipboard interaction is triggered).Screenshots/Videos (if applicable)
N/A (backend/prompt-template change, no new UI).
AI Assistance
If AI was used: