Add clipboard automations#1422
Open
dansimau wants to merge 1 commit into
Open
Conversation
Run custom shell scripts when copied text matches a regular expression, replacing the clipboard with the (optionally rich-text HTML) result while keeping the original copy in history. Scripts run via NSUserUnixTask from ~/Library/Application Scripts/<bundle-id>/, which executes them outside the app sandbox with the user's normal privileges (network, filesystem, Homebrew tools) while Maccy itself stays sandboxed. No entitlement changes required. - Automation model (name, regexp, extensible action enum) persisted via Defaults - AutomationProcessor: matches, chains scripts, publishes a single new entry - ScriptRunner: NSUserUnixTask wrapper with stdin/stdout piping and timeout - New Automations settings pane with live scripts-directory watching - Tests for matching, chaining, output handling, and skip rules Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
dansimau
commented
Jun 18, 2026
| "Untitled" = "Untitled automation"; | ||
| "SelectOrAddHint" = "Select an automation to edit, or add one with +."; | ||
| "Name" = "Name"; | ||
| "NamePrompt" = "GitHub PR → rich link"; |
Author
There was a problem hiding this comment.
Use a more generic example/placeholder name here
| TextField(text: automation.regexp, prompt: Text("RegexpPrompt", tableName: "AutomationsSettings")) { | ||
| Text("Regexp", tableName: "AutomationsSettings") | ||
| } | ||
| .font(.body.monospaced()) |
|
|
||
| do { | ||
| let output = try await scriptRunner.run(scriptName: config.scriptName, input: current) | ||
| let cleaned = trimTrailingNewlines(output) |
Author
There was a problem hiding this comment.
This creates a problem if users want to intentionally trailing newlines in their script output.
Probably we should just strip a single trailing newline, which allows people to use echo and variants as they normally would.
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.
Add an automations pane where users can configure scripts to run on matching clipboard regexps.
NSUserUnixTaskfrom~/Library/Application Scripts/<bundle-id>/, which executes them outside the app sandbox with the user's normal privileges (network, filesystem, Homebrew tools)Screenshot/example
In the following example, I've written a script to convert plain text GitHub PR URLs to a HTML link with the PR name as the title: