Martchus / syncthingtray

Tray application and Dolphin/Plasma integration for Syncthing
https://martchus.github.io/syncthingtray/
Other
1.66k stars 44 forks source link

Syncthing configuration detection when using the new configuration paths (Syncthing v1.27.0+) #216

Closed spantaleev closed 10 months ago

spantaleev commented 10 months ago

Syncthing v1.27.0 defaults to using $XDG_STATE_HOME/syncthing or $HOME/.local/state/syncthing for its configuration. If defaults to the old directories ($HOME/.config/syncthing) if it finds them, but would prefer the new ones otherwise.

I've migrated my old Syncthing setup's configuration to the new paths (mv ~/.config/syncthing ~/.local/state/syncthing), but a fresh Syncthing v1.27.0+ setup would use the new paths by default.

When configuration is in ~/.local/state/syncthing, Syncthing Tray fails to detect it during its configuration wizard and says:

It looks like Syncthing has not been running on this system before as its configuration cannot be found. Is that correct?

It's awesome that Syncthing Tray nevertheless lets you point it to your configuration directory (~/.local/state/syncthing) manually and everything works as expected afterwards. Still, it'd be great to add support for these new paths, so that new users (starting with Syncthing v1.27.0 and its new default configuration paths) would not be confused.


Additional context

I'm running syncthingtray=1.4.10-1 installed from the AUR in combination with syncthing=1.27.0-1.

Martchus commented 10 months ago

Good that you bring that to my attention. I somehow didn't realize I'll have to adapt the lookup when reading the changelogs. This should be fixed on master.

Note that my integration tests haven't caught this because they override the config directory default to avoid interfering with the real setup. So I guess it is still the best to test this only manually.

spantaleev commented 10 months ago

Thank you for looking into it and fixing it so quickly!

I've confirmed that it's fixed on master - starting with a fresh configuration (no ~/.config/syncthingtray.ini) and going through the setup wizard was smooth.


I've had some troubles figuring out how to stop the current applet. There was no Close button button on right-click for some reason, although I see such a button now that I've reinstalled. Perhaps if syncthingtray starts via autostart, something is different.

There was no obvious process that I could kill (ps aux | grep syncthingtray was not showing anyway), but it does show /usr/bin/syncthingtray now.

It was hard to figure out how to reset it and make it start with fresh configuration (via the applet, you can delete configuration profiles but you cannot delete the last one). At some point, I've discovered ~/.config/syncthingtray.ini.

Martchus commented 10 months ago

I've confirmed that it's fixed on master - starting with a fresh configuration (no ~/.config/syncthingtray.ini) and going through the setup wizard was smooth.

Thanks. I did my own testing but it is always good to have feedback.


I've had some troubles figuring out how to stop the current applet. There was no Close button button on right-click for some reason, although I see such a button now that I've reinstalled. Perhaps if syncthingtray starts via autostart, something is different.

There was no obvious process that I could kill (ps aux | grep syncthingtray was not showing anyway), but it does show /usr/bin/syncthingtray now.

It was hard to figure out how to reset it and make it start with fresh configuration (via the applet, you can delete configuration profiles but you cannot delete the last one). At some point, I've discovered ~/.config/syncthingtray.ini.

The situation depends on what version use use.

  1. If you use the platform-neutral tray application there's a dedicated process and you can close the whole application via the right-click menu.
  2. If you use the Plasmod for the the Plasma desktop there is no dedicated process. The Plasmoid is loaded as part of the shell (which is the plasmashell process, so killall plasmashell && plasmashell would "refresh" the Plasmoid). This is simply how Plasmoids work and I cannot change this.

It sounds like you've been switching from 2. to 1. considering you now have a dedicated process running.

Note that in both cases the configuration file you've mentioned is used (and when it comes to the Plasmoid then Plasma-specific settings are additionally stored on Plasma-shell level).


Maybe it makes sense to document the location of Syncthing Tray's config file. I'm also wondering whether it would make sense to switch to the state directory as well because the connection settings contain API keys and other values one probably don't want to share/sync between hosts. Probably I needed to split the configuration for that to have a "universal preferences" part and a host-specific part.

spantaleev commented 10 months ago

Thank you for the detailed explanation!


On a related note, I've also noticed that when the .desktop autostart file is placed, I get 2 instances of syncthingtray in my tray. One of them is closable.

They look similar, but the UI is a bit different. Their Settings are also different, with the "real one" (the one started from the binary and the one that's closable) providing much more settings. This is a bit confusing.

I've since removed the autostart entry by unchecking the checkbox in Settings -> Startup -> Autostart -> Start the tray icon when the desktop environment launches and I only get 1 instance started after a fresh startup.

I'm not sure what starts this plasmoid instance and how I can disable it (perhaps by uninstalling and restarting the KDE session), should I ever wish to do so. I'd probably be happier with disabling this one completely and having the real (closable) application start via a .desktop entry.

Oh, and I have now figured out how to start the setup wizard subsequently, even when running just the plasmoid. In its settings, on the top right (right beneath the Minimize, Restore, Close buttons) there's a tiny icon for launching the Setup wizard. It's easy to have it go unnoticed though.


Despite these UI/UX issues, syncthingtray appears to be working great! Thank you for all your hard work on it!

Martchus commented 10 months ago

On a related note, I've also noticed that when the .desktop autostart file is placed, I get 2 instances of syncthingtray in my tray. One of them is closable.

They look similar, but the UI is a bit different. Their Settings are also different, with the "real one" (the one started from the binary and the one that's closable) providing much more settings. This is a bit confusing.

Those are the two versions I mentioned before.

I've since removed the autostart entry by unchecking the checkbox in Settings -> Startup -> Autostart -> Start the tray icon when the desktop environment launches and I only get 1 instance started after a fresh startup.

I'm not sure what starts this plasmoid instance and how I can disable it (perhaps by uninstalling and restarting the KDE session), should I ever wish to do so. I'd probably be happier with disabling this one completely and having the real (closable) application start via a .desktop entry.

None of those is more "real" than the other. The autostart setting is only available for 1. as it is basically a normal application that you may want to start automatically. 2. on the other hand can be configured like any other Plasmoid and the shell takes care of this, checkout https://github.com/Martchus/syncthingtray#configuring-plasmoid-and-dolphin-integration for more information.

Oh, and I have now figured out how to start the setup wizard subsequently, even when running just the plasmoid. In its settings, on the top right (right beneath the Minimize, Restore, Close buttons) there's a tiny icon for launching the Setup wizard. It's easy to have it go unnoticed though.

The wizard will also show automatically for 2. when it is added/shown for the first time (but not if 1. was shown before).

Martchus commented 10 months ago

The change for the config directory is part of the latest release.

I added https://github.com/Martchus/syncthingtray#general-remarks-on-the-configuration and reworked subsequent README sections. This should make the configuration of the Plasmoid and "closing" it more clear.

The ideas for improvement mentioned in https://github.com/Martchus/syncthingtray/issues/216#issuecomment-1849052817 haven't been implemented yet. However, I'm also not quite sure about them so I'll leave Syncthing Tray's own config for now as-is.

spantaleev commented 10 months ago

I'm happy to read about these differences - it all makes sense now! :bow:

However, I think that few of the users will (or should) end up on the Github repository and README document, let alone read all of it.

Maybe it's better if the setup wizard itself could tell people about the Plasmoid vs .desktop application launching thing. It could be a single sentence somewhere around the autostart checkbox, which links to the section in the README. It could also clearly say that it's not recommended to enable application autostart, because the Plasmoid would be enabled anyway (without the possibility to disable it, even).

Martchus commented 10 months ago

However, I think that few of the users will (or should) end up on the Github repository and README document, let alone read all of it.

I would actually hope that most Plasma users know the difference between a Plasmoid and a regular application. I would also hope that users read at least the first few paragraphs of the README that states the existence of both versions. This is not much different than Plasma's own NetworkManager Plasmoid vs. the standalone nm-applet.

.desktop application launching thing

I would definitely not call it like this.

if the setup wizard itself could tell people

The setup wizard - when invoked as part of the Plasmoid - already skips the autostart configuration. Maybe it should actually check whether the stand-alone application is running an suggest closing it and check whether autostart of the stand-alone application is enabled and suggest disabling it. The only problem with this approach is that if you had the stand-alone application opened already then the wizard wouldn't show anymore anyways as it is not generally the first launch anymore. So maybe it makes most sense to show a (permanently dismissable) warning outside of the wizard.

This is all work to implement so I'm not sure whether I'm going to spend the time. Not that many Plasma users were asking about this before and now I can simply point to a README section.

spantaleev commented 10 months ago

My experience is with finding out about syncthingtray from the Syncthing Tray section on the Syncthing wiki page on ArchWiki.

From there, I proceeded to install it and then launch it manually (like any other app). I probably should have paid more attention to the Plasmoid vs standalone app distinction. I did not see the Plasmoid start automatically after installation and I'm not sure how I'd get it to do so (perhaps by restarting my Plasma session?). For this reason, I launched it manually and then decided "oh, autostart sounds good - I'll enable it".

I suppose I should have probably read more about the different run modes. Even the section in the ArchWiki mentions them. I suppose I was busy and more careless at the time, but I'd expect most users would be that way most of the time anyway. After all, users don't read.

I understand that your time is limited and fixing these things provides little value (and mostly to more ignorant or distracted people), so feel free to ignore it all. Thank you for the well-built application! :bow: