API: Check when sync is "finished"? LocalIndexUpdated false positive?

I also noticed that this is tricky when developing Syncthing Tray. There I also ended up reading folder summary events like @calmh has already mentioned. For remote devices one could query db/completion on RemoteIndexUpdated-events (if my memory serves me well).

Note that syncthingctl might already do what you want, see Shutdown computer when sync is done - #3 by Martchus. It only covers the local completion, though.