Idea: Sync Extensions across Macs using iCloud Drive

First off let me just say Thank You! :raised_hands: for creating my favorite macOS utility.

I’ve been using it since it appeared in the App Store years ago now.

It was literately the first thing I installed on my brand new M1 Max MacBook Pro. Otherwise I would have felt lost.

On to the new feature idea (that I’m sure others have asked for)…

I would love to be able to synchronize my PopClip Extensions, and their order in PopClip, across my different Mac systems by having them stored on my iCloud Drive, a WebDav drive, Drop Box, or even as a gist on GitHub.

Especially now that you have the Keyboard Shortcuts added. :sunglasses:

I can manually sync the extensions by going into ~/Library/Application Support/PopClip/ and linking the Extensions folder to my iCloud Disk under a PopClip Directory. This works, but it would be far superior if this was built into PopClip.

I would even dare say (others might hate me for it) that this enhancement to PopClip would be worth paying for as an in-app purchase “Pro” feature for my $s.

Thank you again for your amazing utility!

  • Kenji
3 Likes

Hi @kenjikato, thank you for the kind words and welcome to the forum :pray:

Thanks for putting this idea down in words. It’s good to have a topic for it, since, as you guessed, it is a fairly common request.

In principle I’m really behind some kind of sync mechanism as I can totally see its utility. The reason it has never happened yet is mainly that syncing is a complex thing to implement, which introduces lots of moving parts and new ways for things to go wrong. There are many design decisions to make and getting it right is a big project.

The good news is that I have spent the last few months completely rewriting the extension loading system in PopClip. (It was mosty pretty old code written in a bit of a rush 9 years ago.) This means there is a much more solid foundation for considering things like this now.

So, I can’t promise anything but I can say that it’s in my mind. There are a few other projects I will be attending to first, notably getting the PHP extensions ported, the JavaScript API documented, a “create your own extension” feature for making simple extensions really easily, and then I really want to have an improved extensions directory and an extensions auto-update mechanism (which, itself, will help lay the groundwork for possible syncing I expect).

I can manually sync the extensions by going into ~/Library/Application Support/PopClip/ and linking the Extensions folder to my iCloud Disk under a PopClip Directory.

You know, I have never actually tried doing that but I can see it ought to work, just about!

or even as a gist on GitHub

That’s an interesting one, hadn’t though of that but you have got my mind working…

I would even dare say (others might hate me for it)…

You mean like this? :smiley:

2 Likes

@nick thanks for the reply.

Your dev roadmap makes sense based on what you have been enhancing in PopClip. Just wanted to make sure the ability to sync was part of your roadmap. :wink:

I’m one of those people who HATES the monthly software subscription model. I understand it, but I am NOT a fan of it myself. On the other hand one off purchases for “power user features" or “Pro features” I’m good with. I believe software devs should get paid for their work (being a developer myself), unless they are putting that work out as open source.

Speaking of open source and syncing. If you are interested at looking at an open source syncing plugin that I find extremely useful. Check out this VS Code extension for synchronizing plugins and customizations. It uses GitHub Gist as the way to store your settings and then sync to other systems. I love it because I can go to a new computer and have all my VS Code settings and plugins running just as I like them within a few minutes. If I make a change on one system it syncs to all my other systems.
https://github.com/shanalikhan/code-settings-sync

If you haven’t looked at Apple’s CloudKit for storing and syncing yet it’s worth taking a look. It’s not as hard as one might think to get it working in short order. I was very surprised at how quickly I was able to get it working with an iOS app that I work on.
Apple CloudKit Samples on Github

I hope this is helpful and thanks again for your great work! :+1:

1 Like

As it happens, I’m also not a fan of the subscription software model (you might have guessed). It does make more sense to me as a one time extra if anything.

That’s awesome, thanks for the tips. One question in my mind is how to handle conflict resolution/merging in the case of divergent changes happening on two machines which don’t sync until later. The other thing is that to actually sync extensions, not just the settings but the extensions themselves will need to be synced and installed in the background, which will be a thing to figure out the mechanism for. But I’m looking forward to eventually diving into it and figuring it all out.

2 Likes

Merge conflicts when syncing is always an interesting and often tricky topic when developing an app.
For the VS Code Settings Sync you get an error in the command output if it can’t resolve the issue (which doesn’t happen that often). For a developer this is OK as most will be able to figure out how to resolve the conflict, but for a general non-developer user it’s not as helpful.

CloudKit along with Core Data have some nice ways to help you resolve the issues. Here are just a couple of links that helped me when getting started with CloudKit and how to resolve merge conflicts. If you look at using CloudKit that is.

Getting Started with Core Data and CloudKit

CloudKit • What is the difference between the various NSMergePolicy Objects?

Cheers!

1 Like

Right now I use Transloader to download new extensions to all of my devices, and then Hazel to open the PopClip files in PopClip (I could use Transloader for this, but I already had Hazel set up to do it, and that Hazel rule syncs) which automatically installs the extension. It’s not perfect, it doesn’t handle the order/position, but it does help.

I’d definitely be in favour of syncing, especially if I could have an extra which was the ability to say “but I want to hide this extension on X machine(s)” or “only show this extension on X machine(s)” - I prefer to sync as much as possible between my work and personal machines to avoid “oh, right, that’s not here”, but equally I don’t always want exactly the same thing - and this extends at times to my personal laptop vs desktop. Though I can imagine I’m an outlier here and most people wouldn’t want that level of control - which would make it a complex feature to implement for potentially very little gain!

2 Likes

@RosemaryOrchard Hazel and Transloader are both excellent suggestions! :sunglasses:

I forget about Hazel all the time until I think I should write an AppleScript to automate x task. Then remember that Hazel can do the same thing easier and quicker usually. :joy:

2 Likes

Popclip is amazing - especially with the new snippets

As for syncing, would a simpler solution simply be to allow us to specify the location of our externsions somewhere other than the Application Support folder? If I could put the extensions in a Dropbox folder, then that would handle the syncing.

I suppose it might have issues if I am using two computers at the same time and I might have to restart Popclip so new extensions are recognized on the second computer, but those would not be a big deal for the typical use case of one user, one desktop computer, and one laptop computer.

specify the location of our externsions somewhere other than the Application Support folder

I think you can do that already by replacing the PopClip folder in Application Support with a symlink into a folder in your Dropbox folder. As you say, it would need to you restart PopClip on the other Mac after making a change on the first. Not officially supported but I think a couple of users already do that, might be worth a try.
That said, for a proper syncing solution I would want it to be more robust than that and also sync the settings and the order of extensions.
Welcome to the forum, @rkaplan :slight_smile:

1 Like

Thanks - I will try that idea with the symlink for now!

:+1: I would be interested to know how it goes

So far it seems to work well - with the understanding that I need to quit and restart Popclip when switching computers, as we discussed.

I am syncing the whole “Popclilp” folder - can you clarify what the LaunchDatat and AppData files do? Or should I only sync the Extensions subfolder?

1 Like

_LaunchData contains a copy of your Mac App Store receipt or any license key files applied.
_ActivityData is a log of PopClip’s recent actions to help in debugging.

For extension syncing in fact only the Extensions subfolder will need to be synced. Thinking about it, I would recommend syncing only the Extensions folder but syncng the whole thing ought to be fine too.

1 Like

@nick

This continues to work well. However I realized that when I reorder extensions or turn some off/on, those changes are not synced. What location would I need to sync for that to be included in the process?

The actions order is in ~/Library/Preferences/com.pilotmoon.popclip.plist along with the other app prefs. It’s not designed for syncing but might work as long as you always restart app after making changes on other Mac…

1 Like

Thanks @nick - that works indeed

Appreciate if you can share the exact steps to follow for syncing between two macs, preferably using iCloud

(1) Install this Mac service to use a right-click to Make Symlinks:

(2) Create a Dropbox folder called Popclip [Same concept if you use iCloud - not really any different]

(3) Find the folder ~/Application Support/Popclip and copy it and its contents to the folder in Dropbox/iCloud called Popclip.

(4) Right-click on the Popclip folder in Dropbox and choose to Make Symlink

(5) Delete the Popclip folder in ~/Application Support/Popclip and move the new Symlink to its place. Rename that Symlink from Popclip.symlink to Popclip.

(6) On your second Mac, repeat steps 4 and 5

(7) Repeat steps 2-6 for the file (not folder) called ~/Library/Preferences/com.pilotmoon.popclip.plist

2 Likes

Thank you for the steps. Oddly, I cannot see the Popclip folder in Application Support. I enbaled hidden files, just in case. Is there a possibility that these are stored elsewhere?

Check both /Library/Application Support

and also

/Users/yourname/Library/Application Support

The latter is also known as

~/Library/Application Support

1 Like