Kilian / fromscratch

Autosaving Scratchpad. A simple but smart note-taking app
https://fromscratch.rocks
MIT License
719 stars 63 forks source link

Idea: file change listening == makes fromscratch sync-capable! #104

Open jkbecker opened 4 years ago

jkbecker commented 4 years ago

Hi!

Fromscratch looks great! I was trying to set up a confidential scratch pad that syncs between my computers, and so I symlinked the ~/.scratchpad directory to a directory that I have synced across multiple computers using Syncthing.

Since the actual synchronization is handled by the underlying synchronization program (could be Syncthing or any number of cloud storage services like Dropbox/OneDrive/iCloud/ etc.), the only thing fromscratch would need to do to support seamless cross-device sync is to listen for file changes and update them in the UI - so that when I write something on machine A and machine B has fromscratch open, as soon as the synchronization comes through, it just reloads the UI to show the updated content.txt.

I realize this could result in sync issues that are more or less easy to resolve (which depends on the cloud storage provider, mostly), and it's probably not a feature to immediately advertise for that reason. But for advanced users who are aware of this and are willing to resolve a conflict manually (or simply avoid it by not typing on both ends at the same time), this could give fromscratch basic sync capabilities with very little effort (I assume - I don't know enough about Electron to say exactly what needs to be done. But I assume there is some way to watch a file for changes and trigger a content reload based on that?

I totally understand if you consider this out of scope - just an idea! :)

jkbecker commented 4 years ago

On second thought: Even just a shortcut that triggers reloading of content.txt would do it for me :)

Kilian commented 4 years ago

Hey! I don't have a lot of time to spend on FromScratch lately (Focussing fully on Polypane). The difficult thing to solve here is that FromScratch also saves to that file on every change. If we also load that file on change (for example, using chokidar) we would need to do two things:

Both can be handled easier, I think, by a sync server that syncs delta's (like CRDT) and doesn't care about what's being saved to disk. But those are just far-future thoughts.