5

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.

OpenWithFF

    8 months later

    Another extension that's similar to the deprecated OpenWith is External Application Button: https://github.com/andy-portmen/external-application-button

    Maybe it's helpful to also look at this extension, though it's a lot more complex than OpenWith. Just sending selected text or URLs as is to local scripts (or applications like IINA, VLC etc.) or downloaders like yt-dlp, in a direct and simple manner, should imho be the first step, if this is to be implemented in Orion in some form. If needed, additional settings and tweaks could be added later. (In my view, any complexity & parsing etc. should primarily be added by the user in the local script anyway, not within Orion.)

    • Vlad replied to this.

      JayBrown It is not the case that we would not know how to do this, but of prioritiziation. We have over 2000 open issues. This is extremly niche and has only 2 upvotes. We have only 3 devs. It will take a while. Supporting Orion helps us expand the team. Thanks.

      a year later

      So my best solution (which I have not tried for this use case) is to use this All-Powerful free app called Velja.

      To Vlad: I'd put this issue on very low-priority for now. I found an alternative solution.
      (I Believe) you can set it up to open links from--specifically Orion--to some pre-determined browser OR even a custom app that takes in the URL (which I haven't tried).
      My only problem with it is that the "fn+click" or any other modifier doesn't work on Orion. But you can still install the Chrome Entension and have Right+Click Abilities.

      To Vlad: I'd put this issue on very low-priority for now. I can only say that maybe allowing this would be good for Siri Shortcuts? Since I tried making a Quick Share Service, and it couldn't "get" urls (but only would get the title of the links 'e.g. CLICK ON THIS LINK as the title'). I was able to make it work with "share sheet". But that requires like 3 or four clickes through the helper menu. Using "Services" requires 2 clicks..

      3 months later

      There's similar functionality in the Tridactyl extension via its native_messenger; but I'd like to :+1: this as a built-in feature.

      It's a perfect fit with the "programmable buttons" and Orion's flexibility in general; a great poweruser feature; and an opportunity to implement it a little more securely (and less jankily) than an extension will ever be able to do.

        No one is typing