Document the use of inotify in order to reload Sticky-Notes when using Syncthing
Thanks a lot for providing Styncy Notes!
I am testing the use of Styncy in combination with Syncthing. As documented, Sticky-Notes does not detect/ reload when syncing from Android to Sticky-Notes (e.g. on Linux Mint).
Therefore, I tried to use inotify for the task: The last operation of Syncthing (when syncing) is a "MOVED_TO" operation. This can be exploited, using inotify.
The following bash script achieves this. This could also put together as a one-liner.
I just wanted to suggest documenting the use of inotify - as another way to trigger the reload.
#!/bin/bash
inotifywait -m -e move \
"/home/YOURUSERNAME/.config/sticky" | while read DIR EVENT FILE
do
if [[ ${EVENT} == "MOVED_TO" ]] && [[ ${FILE} == "notes.json" ]]
then
dbus-send --type=method_call --dest=org.x.sticky /org/x/sticky org.x.sticky.ReloadNotesFromFile
fi
done
and as an one-liner:
inotifywait -m -e move "/home/YOURUSERNAME/.config/sticky" | while read DIR EVENT FILE ; do if [[ ${EVENT} == "MOVED_TO" ]] && [[ ${FILE} == "notes.json" ]]; then dbus-send --type=method_call --dest=org.x.sticky /org/x/sticky org.x.sticky.ReloadNotesFromFile; fi; done
Edited by goebbe