Open a folder as a Positron project from Finder on macOS as a service or quick action #8614
Unanswered
andrewheiss
asked this question in
Feedback
Replies: 1 comment
-
Thank you so much, @andrewheiss, for this and all the other helpful materials you have been sharing on using Positron! 🙌 🏆 🤩 I opened #8614 as an issue for us to track and prioritize this kind of feature. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Currently, when installing Positron on Windows (see here), there's an option to add an "Open with Positron" action to the Windows Explorer directory context menu. This makes it easy to open a folder as a project. Right click on the folder, choose "Open with Positron" and voilà—you're in business.
On macOS this isn't directly possible, and as noted in the page on Rproj files, "There is no true equivalent of this in macOS, sadly"
However, there is a way to add this ability underneath one extra folder level in the right click menu, and many other macOS apps use the same approach to make it easier to open folders in specific applications. I have a full writeup here—here's the quick version:
You can create an Automator Quick Action or Service that will open a selected folder in Finder in Positron:
Set "Workflow receives current" to "folders" in Finder
Drag the "Run Shell Script" action from the Actions Library to the workflow
Set "Pass input" to "as arguments"
Paste this script into the script area:
Here's what it looks like when finished:
Once that's saved, you can right click on any folder in Finder, go to Quick Actions, and open it in Positron:
I think that theoretically this ability can be baked into Positron natively. As noted in the full blog post, lots of macOS apps add stuff to the Services menu. Like, I can open a new iTerm2 tab to this folder, or open the folder in DiffMerge, or encrypt/decrypt files with OpenPGP. Those options are all available because I have iTerm2, DiffMerge, and GPG Suite installed.
These services are defined in each app's respective
<App Name>.app/Contents/Info.plist
file (see Apple's official documentation here, or this example). For instance, DiffMerge has this entry in itsInfo.plist
:BUT I don't know anything about official macOS development and how to create plist files like this, and I don't know how this all interacts with Electron and its build process.
It could be neat (and help with parity with Windows) if there were a way to add an automatic and native "Open with Positron" service so that people could right click, go to Services, and open folders as projects in Positron.
Beta Was this translation helpful? Give feedback.
All reactions