Closed kflpk closed 3 years ago
QOwnNotes watches the notes in the note folder for changes, but that depends on if the operating system reports those changes.
You can also manually reload the note folder (see note menu).
Btw. you can watch the external modification events in the log panel of QOwnNotes.
Okay, thank you, I didn't realize that 'reload the note folder' would reload the notes themselves, for some reason I thought it only updates note list. That being said, after reloading, the program seems to update on reloading the folder and only one time after, when I save from external editor. Then I have to reload the folder again. I'm using PopOS 20.10 if that's important.
If QON gets the events depends all on inotify events... Maybe other applications are already using the maximum amount of watched files your distro has setup (you can increase those settings in your distro).
And do you get log entries if a file changes in the note folder?
I only get one when the note reloads, so when I save after reloading I get one log entry, and it stops when I'm trying to save again until I reaload the folder again.
Can you please explain in more detail and step by step what you did.
Yes, of course
Shift+Ctrl+o
:w
command.
Now the note in QON reloads automatically and I can see the changes, the log entries are printed. Shift+Ctrl+r
So the problem is that QON only updates for me when I reload the note manually, and then it updates automatically exactly one time after I have reloaded the note.
I tried that with KDE Neon (but with Kate as editor). I was able to edit and save the note in Kate and every time I saved it I got the dialog that "the current note was modified outside of QON", along with the dialog that showed me what changed. This worked multiple times without reloading the note folder.
You didn't post your settings as suggested in the issue template and I don't have any logs so I don't know what's different for you.
Oh, sorry, I didn't realize I need to put my settings Here they are
I also checked the logs after opening QON
I started QON, modified a file twice, reloaded manually, and then saved it twice again. As you can see in the logs, only the first external modifications were registered.
The settings look ok.
[15:58:19] [debug] notesWereModified: "/home/kacper/Nextcloud/Notes/Test/debug.md" [15:58:19] [status] Current note was modified externally
I can see these two lines at the end after the note folder was reloaded.
Did you get a dialog at the first external change?
acceptAllExternalModifications
maybe try to set that to false (General settings)
notifyAllExternalModifications
maybe try to also set that to false (General settings)
if that doesn't help you can try to start a new session (with fresh settings), see https://www.qownnotes.org/getting-started/cli-parameters.html#command-line-interface-parameters
Did you get a dialog at the first external change? Yes, I did, and I set it to accept all future changes.
I already had notificatons set to false, I set it to always accept external changes. When changing it to notify on every change the situation is the same. It notifies me one time after a reload and stops until I manually reload the note folder.
When I start a new session, the program notifies me about external modifications via the bar at the bottom and in log entries every time I save, but the preview doesn't update now
So in a new session you are able to get external updates of your current note after a note folder reload in the note edit panel, but not in the note preview panel?
I get a notification about external modifications every time I save the file, but the preview only updates when I manually reload with Shift+Ctrl+r
Now it's back to the way it was at the beginning, even though I created a new session, not sure what's going on.
For me the preview also updates when I change the file externally.
I checked it out on a laptop also with PopOS, with bspwm, Gnome and Plasma and none of them seemed to work properly, this leads me to believe, the problem may be how PopOS handles some stuff. The OS on a laptop was a fresh install from yesterday. I may try running it in a virtual machine with other distro or installing it on a laptop on different partition and check if other distros have that problem.
Really strange...
I checked it out on kubuntu and found something interesting. When I used neovim as I usually do, the notes still updated only the first time after a manual reload. Then I tried using Kate, and it did not update until I reloaded the note folder (which I expected). However, after I had reloaded the note folder, I could finally get consistent updates every single time I saved using Kate. This behaviour seemed to only work with Kate, but I haven't tried other editors. When I opened the file again in neovim and tried to save, the note didn't update, and the behaviour seemed to be back as it was before. So it seems that the distribution is not the problem (or at least not the only one) and it has something to do with the way Kate (or KDE apps in general) handle saving a file.
I think vim uses swap files... Maybe they are copied over the other file... The problem is that everything depends on what events are received by https://doc.qt.io/qt-5/qfilesystemwatcher.html
is there some way i could make some ugly workaround that reloads the file every second or so? i guess i could try to make some script but i don't know any QML
Okay, I believe I found a solution. I've read that the problem is not Qt handling stuff in a specific way, rather vim's weird save mechanism it seems like vim is not appending to a file, it's making a temporary copy of a file and renaming it on :w
.
There is an option that controls it's behaviour. It seems like after adding set backupcopy=yes
to your .vimrc
(or init.vim
in neovim) it updates rather consistently. However I noticed that sometimes when you make a change, save, then undo that change and save again it doesn't always update (my guess is that vim caches some previous versions of the file and swaps it if you undo the changes, but i really have no idea). But in general it seems to work fine now.
Good to know, thank you for gathering the information! I will close this issue then.
Is there a way to manually refresh a note? I use vim to edit my notes, and when I save it very rarely updates the note in QON. I coudn't find any way to manually refresh a note (aside from restarting the app) and I was wandering if something like this could be added as an optional shortcut? Alternatively it could update every time a file is saved from external editor (it sometimes did it in my case, but it was very rare so I'm assuming this functionality doesn't exist, or it's bugged if it does)