- Edited
Brief Summary
Send selected text or an image or a URL, e.g. the current page's URL or a URL from a hyperlink or an image URL, directly to local (shell) scripts without going the additional route via the Services menu and macOS Automator actions.
Similar functionality
In Firefox there used to be the OpenWith extension, which still works, but is now discontinued. In browsers that support the macOS Services menu (like Orion), you can use the Services menu to call workflows that contain your script, or that basically run do shell script "/usr/local/bin/myscript.sh"
Details:
(1) Select a URL and right-click, or right-click on an image, or right-click on a hyperlink on a page, or select text on a page and right-click, and in the contextual menu don't go into "Services", but instead there's a submenu, e.g. "Execute Local Script…", which has been populated by the user with local (shell) scripts
(2) In Orion's settings, the user should then have the option to add paths to local (shell) scripts into a list, while the relevant script files can be located either in a dedicated folder managed by Orion (e.g. in ~/Library/Application Scripts/com.kagi.kagimacOS
), or in one of the standard paths like /usr/local/bin
or ~/.local/bin
etc. (A dedicated folder would be safer, I assume.)
An additional functionality could be to add an individual icon to each added script, e.g. from a png/jpg or SF Symbols, to make the submenu contents look nicer.
The display name of the script (as the item display name in the contextual submenu) could be determined either by the name of the local script file, or the user could add a display name manually in the script list in Orion's settings.
In the script settings, users could also add keyboard shortcuts to call a specific script, and if no content or URL has been user-selected beforehand, Orion would then always send the URL of the current page/tab to the script.
The advantages are probably faster execution (no detour via macOS Services), direct execution without intermediate AppleScript, running a local script detached as much as possible both from the originating app and from the macOS environment (less potential restrictions), support for a lot of script formats, scripting languages, and possibly even compiled executables, and it would be a native & integrated way to run local scripts, which would be a nice companion to Orion's programmable button.
Nota bene
If this functionality (running local scripts) is already possible with Orion's programmable button, please disregard my feature suggestion, but afaict the programmable button only runs scripts in-browser (in-tab), right?
Instead of using the settings, the contextual "Execute Local Script…" submenu contents could also be managed/populated by the user from the programmable button settings, but imho that would compound different functionalities.
Similar to how xbar works, the user could also configure a script's Orion settings in the script itself, e.g. in comment lines near the top, which Orion would then need to parse & apply, for example:
#!/bin/zsh
# OrionScriptDisplayName:Foo Bar
# OrionScriptDisplayIconFile:/Users/foo/Pictures/Orion/bar.png
# OrionScriptDisplayIconSFSymbols:foo-bar
# OrionScriptKeyboardShortcut:CTRL-ALT-CMD-J
# main script
Image/Video:
Here's how the contextual submenu looks more or less in Firefox when using the OpenWith extension.