Feature Request: OS X Finder Sync app extension

Wouldn’t it be great if Synching could have a Finder Sync app extension? I’m trying to study the OS X and Synching API in order to understand its feasibility. Here’s some useful features we could implement:

  • Receive notifications when the user starts or stops browsing the content of a monitored folder’ - we could automatically trigger the Synchting scan whenever a monitored folder has changed.
  • “Add, remove, and update badges and labels on items in a monitored folder.” - this is my #1 feature. Just like Dropbox does, we could add badges and labels to items ( updating, just updated, out of sync, etc ).

What do you think?

1 Like

Sounds good - could you write it and submit it?

That’s what I was thinking of but I never wrote a Finder Sync app extension so I have to study the API.

I think I will try to implement the badge feature first, the idea is to use the REST API ( in particular the /rest/need ) to obtain a list of files to be synced in the current directory.

Depending on what’s needed, we may be able to do some changes. I.e. if what you really need is to be able to query for the status of a given file, that’s not currently available but could easily be implemented!

Yes, that’s what I would need. Basically OS X asks me “How about this file X?”, “What badge do you want to place on top of file Y?”. That’s what I thought:

  1. A list of folders synced by Synching using the /rest/config API.
  2. For any given file, in any given folder, I need to define a state ( updating, synced, out of sync ). I thought I could use the /rest/need, is it viable?

/rest/need will give you what you need, but it’s an expensive call, hence make sure you are not overdoing it. There is also /rest/events which fires off things such as ItemStarted and so on, to indicate that item sync is in progress.

I guess we could add ItemFinished too nowadays.

/rect/events looks amazing, I didn’t considered that. I’ll try to make a prototype and see how it works.

Hi. From your description, what Finder does to add badges sounds very similar to what Nautilus does. And as I spent yesterday coding exact same feature for Nautilus, I can assure you that querying /rest/need every time when you are determining badge on file will fry your CPU alive :smile:

Best approach I managed to think up so far is to read /rest/need when plugin/extension is starting and then listen for ItemStarted and LocalIndexUpdated events. Only problem is memory cost of list with all of files being synchronized, but unless Finder starts new extension instance for each window, it shouldn’t be too bad.

Thank you for the feedback! The App Extension is launched by Finder when the user opens a “monitored” folder, I still have to investigate if the extension keeps running when the user closes the window.

Now, how to distribute it? I’ll create a GitHub repository but App Extensions requires to be Sandboxed and Codesigned. I should also upload the code signed binary ( using the DeveloperID instead of Mac App Store ).

Sandboxing could be a problem because the user should somehow select the folder ( actually in the prototype I’m running it works even without having to present an open panel but I’m sure what happens when I sign with my DeveloperID ).

I was playing with the /rest/event API before, is there any way to be notified on new events? If not, what interval do you think could be viable? Any sec?

UPDATE: I’ve started working on SyncthingKit, a simple framework that wraps the Syncthing REST API. I still have a lots of work to do before it could be used by anyone else thought.

/rest/events has this concept of since and limit. Every event has ID, let’s say the last event was id=10, now if you call /rest/events?since=10 the http call will block until a new event (id > 10) will be generated and will return you the event. Worst case the call will timeout after a minute if no event has happened and you’ll have to re-repeat the same call again.

And limit defines the maximum number of events you are willing to accept in a single call.

That sounds great, thank you!

I read about since and limit but the Event Wiki says nothing about the blocking call ( maybe we could update it ).

Hi,

I’m working on Finder Sync too, but I see Finder sync requires sandbox and needs a provisional certificate. So I wanted to ask you if you were able to codesign with your Developer ID or appstore 3rd party Mac developer? and was able to distribute it?

thanks,

-Munir

Hi, I’m novice for os x programming and looking for the solution for how to develop drop box like application, what i mean is that i required to create a new menu item in finder window and when that icon is clicked it’ll open directory like structure in the same finder window as drop box actually does. I wondered from last few weeks and found to use finder sync, can any one please tell that from where to start with and what steps are there to follow.Your help will be highly appreciated.