obsidian-livesync
obsidian-livesync copied to clipboard
Request: Allow syncing core plugin settings and editor settings
Hi! First of all, thank you so much for making this plugin, I am absolutely loving it so far.
However, now that you can sync plugins and their settings, I was wondering if there was also the possibility of adding the following features:
- The ability to sync core plugins and their settings
- The ability to sync editor settings, like
app.json
,appearance.json
and so on.
These features would be very useful to me, and I'm sure they would also benefit other users. Thanks!
Thank you for using this plugin! I'm very honored!
If you don’t want real-time detection (as same as plugin sync), it's not so difficult. But I don't sure that obsidian detects the modification of these files.
I'll try and test once!
Progress report!!
First of all, It will be implemented with some limitations!
The limitation is based on simple reasons, Obsidian doesn't notify changes about these files. So we have to check the file status as periodical (in livesync) or before replication at once(in a periodical or manually sync). Therefore, conflict resolution is required, but the content difference wouldn't help us. We have to keep the clock synchronized more than before. (But it's the same condition as other synchronizing solutions, it will be not so fatal.). the latest file will be a winner.
So, we have to choose what we sync or not sync. It will be as regular expressions.
Plugin folders will be synchronized too. But I will not implement that reloading plugin automatically. It made serious trouble in developing.
In a few days or a week, this feature will be released as an experimental feature.
This feature has been released on v0.12.0. Be sure to back your vault up. we're on the cutting-edge. Automatically reloading is not implemented, but notification and click-to-reload are implemented!
Hi! I finally got around to testing this feature.
While it works great with plugins and their settings, it doesn't appear to work as expected with Obsidian's editor settings. When reloading after the settings are synchronized, it appears that Obsidian saves its settings to the files anyway, overwriting the synchronized settings.
Not only does this cause Obsidian to ignore the synced settings, but it also causes LiveSync to now think that the settings have changed (due to Obsidian overwriting them), causing Obsidian's default settings to be uploaded as the "changed" settings.
It seems like you have to find some way to force Obsidian to reload without causing it to save its settings to the settings files first.
(Obsidian's default Sync plugin also has the option to sync settings like this, so maybe you can try to figure out how that plugin does it? Not sure, but good luck!)
Thank you for checking this plug-in! Wow, has overwriting processed after synchronisation? Or while in synchronisation? And could you please check the behaviour when you rewrite them by older revision again by "pick a file to show history"? If it works, the workaround will be found soon.
It seems like you have to find some way to force Obsidian to reload without causing it to save its settings to the settings files first.
Yes, you right. I thought I found that and implemented but seems it is not enough for some environment. May I ask your environment? You can copy that by Ctrl + P -> Show debug info
Hi! As I said, the overwriting seems to happen right before Obsidian reloads when pressing the reload link in your notification, after synchronization has already finished fully. What seems to happen is that Obsidian saves its currently applied settings into the settings files before reloading, which causes all of the synchronized settings to be overwritten.
My environment is this:
SYSTEM INFO:
Obsidian version: v0.15.9
Installer version: v0.14.15
Operating system: Windows 10 Pro 10.0.22000
Login status: logged in
Catalyst license: insider
Insider build toggle: on
Live preview: on
Legacy editor: off
Base theme: dark
Community theme: Atom
Snippets enabled: 3
Restricted mode: off
Plugins installed: 19
Plugins enabled: 19
1: Kanban v1.3.15
2: Icon Folder v1.3.31
3: Calendar v1.5.10
4: Dataview v0.5.41
5: Kindle Highlights v1.6.3
6: Paste URL into selection v1.7.0
7: LanguageTool Integration v0.3.0
8: Export To TeX v0.4.2
9: File Explorer Note Count v1.2.0
10: Custom Frames v2.4.2
11: Periodic Notes v0.0.17
12: Natural Language Dates v0.6.1
13: Pandoc Plugin v0.2.5
14: Recent Files v1.3.3
15: Remember File State v1.0.6
16: Regex Find/Replace v1.2.0
17: Completr v2.9.0
18: Focus Mode v1.9.0
19: Commander v0.1.0
Hi! Any update on this?
I apologise for the lack of posts. In fact, I missed it when focusing on other issues, trying to make sure the conditions to reproduce it. So sorry. At the moment I haven't found a way to intervene in the writing and reading of Obsidian settings.
However, it seems that the method of saving files has changed a bit recently. I will have to investigate this a bit more.
I also fogot to notify you of this.
Even if we lost some configuration by something, we can retreive it again by Pick a file to show history
, choosing json file and old revisions, and pressing Back to this revision
.
In most cases, this should help us.
It may be better to check for differences and merge them, rather than simply applying a new file to a particular file. (However, this requires knowledge on a each file.)
Could you please check the differences by this feature and let me know when some configuration has been gone?
Hi, thanks for the update!
Unfortunately, I probably won't be able to test this in the near future. Of course, any help from other users encountering the same issues is always welcome :)
Sync of obsidian settings and core plugins with settings would be great. Let me know if you need help with testing anything.
I completely forgot why this issue is not updated (Sorry...). I should have posted the progress.
However hidden files can be synchronised, and changes are automatically detected now.
@OvrAp3x
Could you please enable Sync hidden files
and check the behaviour? I would like to close this issue if it looks good.
I tested with that on previously without success, however today I tried to run the "touch hidden files" and again tried tonsetup a new device. This time it worked. Obsidian specific settings was synced.
The "only" issue I found is that synced plugins are no enabled by default, but seems it has to be done manually. But settings for those are kept, so not a big deal. Great work, love the plugin😊
Hi @vrtmrz, do you know if this has been fully fixed? Unfortuantely I haven't been able to test it again yet, but I'd love to get back to the plugin if this feature is fully completed now.
Yes, I think so. Hidden files are now synchronised correctly, and if there are conflicted changes, this plug-in merges their changes into one setting (Where there has been no essential conflict, such as editing the same item) Therefore, now we have fewer possibilities of overwriting that for resolving conflicts.
That's great to hear, thank you so much!!
Also, just to confirm: When I enable the "sync hidden files" option, all files in the .obsidian
directory are synchronized, correct? That means that additionally using the "sync plugins" option (where you can select individual plugins and their settings) isn't necessary, and wouldn't produce the intended result since all plugins are synced anyway, correct?
You are welcome! Thank you for contributing to making the plugin better too.
Yes, all files under the dir .obsidian
are fully synchronised. But Skip files can be configured for Hidden files sync
.These plug-ins are still able to be handled by plugin-sync.
You can use both methods at once, for them.
(I configure it to ignore several plug-in directories on hidden files sync, but plugin-sync scans them; to make be able to roll it back.
Hi! I finally got around to testing this feature.
While it works great with plugins and their settings, it doesn't appear to work as expected with Obsidian's editor settings. When reloading after the settings are synchronized, it appears that Obsidian saves its settings to the files anyway, overwriting the synchronized settings.
Not only does this cause Obsidian to ignore the synced settings, but it also causes LiveSync to now think that the settings have changed (due to Obsidian overwriting them), causing Obsidian's default settings to be uploaded as the "changed" settings.
It seems like you have to find some way to force Obsidian to reload without causing it to save its settings to the settings files first.
(Obsidian's default Sync plugin also has the option to sync settings like this, so maybe you can try to figure out how that plugin does it? Not sure, but good luck!)
Hmm, it seems like I'm still getting this issue with the most recent version of the plugin. Files like appearance.json
, app.json
, core-plugins.json
, community-plugins.json
and more seem to be force-saved by Obsidian after this plugin has already downloaded and written them to disk. This occurs even if I press the "restart" link in the popup that this plugin displays when hidden files changed.
The only way to fix this issue is to manually go into the "Select a file to show history" view, going back to the previous version, and then immediately using the "Restart without save" command in Obsidian to reload the app. Having to do this for every Obsidian config file is quite tedious, unfortunately.
Finally reproduced and understood, I really appreciate your patience and explanation. And absolutely quite tedious to fix overwritten files.
I added some internal-method calls, To notify Obsidian of changes to hidden files. We are not sure if it is correct due to the internal API, but I hope that this makes the issue better.
I always appreciate your efforts in helping with tests, would you kindly assist by trying 0.17.20 too?
I just tried a fresh install of the plugin and database with 0.17.20, and the exact same issue still seems to be happening. I recorded this video to show the changes in appearance.json
: When the file is downloaded, the correct version is created (first revision), but then either when Obsidian exits or opens after pressing the "Restart" button in your popup, it reverts to the default appearance settings.
Feel free to let me know if there's anything else I can do to help!
https://user-images.githubusercontent.com/5741138/215466402-a948e5b8-7e5c-437b-89b5-b3e8ea981dac.mp4
Oh, sorry to let you disappointed! thank you for your fast review and screen recording.
It appears to be as you say. May I ask about the platform? Also, it would be nice to have the logs that include three writings until it is overwritten again, with the Verbose log enabled.
I'm on Windows 11 on both devices, using Obsidian 1.1.12, which is the most recent version at the time of writing! I'll reattempt the sync with verbose mode enabled in a bit and then get back to you with the results.
Okay, here's a gist that contains two logs:
- the one that was printed during the session that the very first sync with this (newly added) device happened
- the one that was printed after Obsidian was restarted for the first time after the initial sync
https://gist.github.com/Ellpeck/64ddf668864ff20690ea8b3263298b9b
I hope this helps!
Thank you very much! These logs helped us!
When the conflict has been detected, the plugin will be trying to find the revisions which have been commonly used. If found, merge each difference from that one and apply. If not, simply overwrite with a newer one.
Files on new devices have no older revision. And of course, they are new. Therefore, our config files have been overwritten, unfortunately.
We have to address first-rev items.
This is the intermediate report! Thank you for your kindness!
@Ellpeck Thank you for your patience! Now, we are able to check the difference between them, and choose one of them or merge them! Could you please check v0.17.21?
Sorry that it took me so long to test this, but it seems that LiveSync now asks you which version of some files (appearance, community plugins and core plugins) you want to use, and restarting after selecting the desired one does indeed restore that configuration!
In my specific test, it synced the appearance and app settings files without me having to resolve any issues, and the files named above with some help, however, the hotkeys file was not flagged as a conflicting file and the default hotkeys ended up overwriting the custom ones i had set. For some reason, the second device's revision list for the hotkeys file then only had a single revision (the empty one), while I had already reverted to a previous revision on the original device. The hotkeys file was extremely stubborn, only finally synchronizing to the second device after using the "Sync hidden files" option as well as syncing again multiple times on both devices.
Overall, the hotkeys thing is the only real issue I'm having with the hidden file syncing now, which is great progress!
Thank you for your testing! I am very pleased to hear that it works almost well.
Such behaviour was not expected. Not necessarily because of this, but when using fetch, 'hidden file sync', 'plugins and...' are now temporarily disabled since the v0.17.29. I hope that it makes the situation easier.