nuttyartist / notes

Fast and beautiful note-taking app written in C++. Write down your thoughts.
https://notes-foss.com
Mozilla Public License 2.0
3.73k stars 327 forks source link

Multiple-instance support: open multiple instance, one instance update can directly reflect on another instance #686

Open evan0greenup opened 1 month ago

evan0greenup commented 1 month ago

Currently, only single instance can be opened.

It would be nice to make notes support multiple instance toward single database be opened simultaneously, because user may edit different pages within a single database.

And the content change in one instance can immediately take effect on another instance.

implementation

avoid data corruption:

Aware the content update when other instance make change:

zjeffer commented 1 month ago

Instead of supporting multiple instances, I think it's better if we support one instance with multiple windows. It would accomplish what you propose without having to implement transactions/filelocks/synchronizations, as we would still handle the database through a single instance.

nuttyartist commented 1 month ago

What are you trying to accomplish, @evan0greenup? Editing the same note from multiple windows? If so, how about a split screen feature? Or tabs? Both features I've had on my mind.

evan0greenup commented 1 month ago

@zjeffer ,@nuttyartist , Here I explain the reasons why I make this proposal:

Previously, I make proposal on launch note with custom profile directory. https://github.com/nuttyartist/notes/issues/682. If launching the notes with different profile/database, It is supposed to run a different instance.

Comparison on two approach

The first one is what @nuttyartist and @zjeffer recommended. Attaching to existed instance with same profile/database. (This is also how firefox works). But it require programming with dbus, and the inter-process communication is quite complicated. At least, I have no clear idea on how to implement it. (May be because I am not experienced enough).

The second one is my proposal. Despite of whether there is existed instance running for given profile directory/database filename. Just to ensure in low level multiple instance toward single database will not cause corruption. This approach is straight-forward.

Cross-platform is a big factor for choosing one among these two approaches above.

zjeffer commented 1 month ago

The first one is what @nuttyartist and @zjeffer recommended. Attaching to existed instance with same profile/database. (This is also how firefox works). But it require programming with dbus, and the inter-process communication is quite complicated. At least, I have no clear idea on how to implement it. (May be because I am not experienced enough).

If you only need to accomplish editing multiple notes from the same database, you could add a way to open a note in a separate window (e.g. by double-clicking or with an option in the context menu), which would still be in the same process (so no IPC necessary).