deanishe / alfred-services

Run macOS services from Alfred
MIT License
39 stars 1 forks source link

Folder Support #1

Open kotfu opened 3 years ago

kotfu commented 3 years ago

Thanks for building this tool to access macOS services from within Alfred, it's very useful to me. However, it doesn't seem to work if I select a folder instead of a file. For example, I use iTerm2, which provides a system service to open a new iTerm2 window at the given folder. To use this from finder, right click on a folder, then click Services, and then I see a list of services, including one called "New iTerm2 Window Here".

When I find a folder in Alfred, then invoice the "macOS Services" action provided by this workflow, the list of services available to me in Alfred does not include the "New iTerm2 Window Here" service.

I code a bit, but not in Objective-C or Go. I poked around in the files included in this workflow, and I can see in PathsToPasteboard.js that you set the content type of the pasteboard to public.file-url, which I don't think includes folders. In an attempt to make this work myself, I tried editing PathsToPasteboard.js so the content type was public.folder but that still didn't make the embedded alfred-services binary return services that apply to folders (like "New iTerm2 Window Here". I looked at the alfred debugging log, and poked around in main.go, and I'm not smart enough to figure out where the problem is.

deanishe commented 2 years ago

PathsToPasteboard.js is only run from the Alfred File Action, where there isn't much information about the files available (Alfred throws most of it away).

Try using the "current selection" (or "clipboard contents") Hotkey instead of the File Action. They should put a lot more information on the clipboard, and a lot more macOS services should be available as a result.