sieren / QSyncthingTray

ATT: NO LONGER ACTIVELY MAINTAINED, NEEDS NEW OWNER || A OS X / Windows / Linux Tray App for Syncthing written in C++
GNU Lesser General Public License v3.0
365 stars 30 forks source link

Linux issues (Could not find Syncthing) #20

Closed johnmaguire closed 8 years ago

johnmaguire commented 8 years ago

Hi there,

I was thinking about making a similar project for OSX with a couple features I wanted:

  1. Shares listed in the tray options (with a click opening it in file manager)
  2. Syncing icon

I tried building the application on one of my Linux machines, and am running into an issue, which is almost certainly do to a lack of Qt experience on my part. When I launch QSyncThingTray, the following (probably unrelated) line is printed:

-> % ./QSyncThingTray
QObject::connect: No such signal QLineEdit::currentIndexChanged(int)
^C

However, the real issue is that I get a popup every ~5 seconds (more and more will keep showing up) saying "Could not find Syncthing. Are you sure the path is correct?"

It looks like the path to SyncThing is found via QtSettings, but the tray icon isn't spawning (maybe this is an awesome-wm configuration issue?) when the message boxes are poping up so I'm not sure how to modify the settings. Are they saved to a file somewhere?

I also am a little confused as to why it needs to know the path of SyncThing... does it take the responsibility of launching SyncThing for you? I imagined it would connect back to an already running instance via the streaming API.

Lastly, I was wondering if the syncthing-inotify integration conflicts with any existing syncthing-inotify service I might be running. Currently I run the plugin via a systemd unit.

sieren commented 8 years ago

Hey John,

I'm afraid that one might be on me, as I havent tested the recent changes on Linux. Will get to that later today.

I believe QtSettings saves preferences to some system default part (e.g. /Library/Preferences.. on Mac, not quite sure where on Linux they might be, maybe some hidden .directory in the user home dir?)

Yeah, it should do both. Spawn an instance of SyncThing if it's not already running (hence the path), if thats left empty it should try connecting automatically either way.

So far there is no syncthing-inotify support within that tool for Linux. So there shouldnt be any issues.

Will give Linux a shot tonight and push some fixes depending on what I find. Thanks for reporting! :+1:

johnmaguire commented 8 years ago

Not a problem and thank you for the project. :)

If it should be doing detection for a running instance of Syncthing, I think there may be a bug in that logic as well -- on both my Linux machines, I get the popup despite a version running under my user.

-> % ps faux | grep syncthing | grep -v grep
jmaguire  3521  0.5  0.2 482416 35620 ?        Ssl  02:58   0:32  \_ /usr/bin/syncthing -no-browser -logflags=0

Interestingly on my laptop though, if I close the initial popup, the tray icon appears, and connects to the instance properly! Not sure why it was having issues doing so on my desktop.

Since we're on the topic of pathing issues, I should probably also note that syncthing is installed to the standard /usr/bin/syncthing through typical distro install route. :)

Thank you again!

sieren commented 8 years ago

Hey, I couldnt reproduce the icon issue on Ubuntu/Unity. But it seems like it's an issue related to Qt: https://github.com/telegramdesktop/tdesktop/issues/874 https://github.com/andrew-bibb/cmst/issues/14 https://github.com/telegramdesktop/tdesktop/issues/492 https://bugreports.qt.io/browse/QTBUG-35832

Are you compiling against Qt5.5 ? According to one report, this seems to help?

johnmaguire commented 8 years ago

Durr, my desktop may be on Qt 5.4. I think I downgraded it for a different project a while back. I'll check when I'm home, thank you. :) On Dec 7, 2015 2:12 PM, "Matt Sieren" notifications@github.com wrote:

Hey, I couldnt reproduce the icon issue on Ubuntu/Unity. But it seems like it's an issue related to Qt: telegramdesktop/tdesktop#874 https://github.com/telegramdesktop/tdesktop/issues/874 andrew-bibb/cmst#14 https://github.com/andrew-bibb/cmst/issues/14 telegramdesktop/tdesktop#492 https://github.com/telegramdesktop/tdesktop/issues/492 https://bugreports.qt.io/browse/QTBUG-35832

Are you compiling against Qt5.5 ? According to one report, this seems to help?

— Reply to this email directly or view it on GitHub https://github.com/sieren/QSyncthingTray/issues/20#issuecomment-162628149 .

sieren commented 8 years ago

Cool! Thanks :) Let me know how it works!

johnmaguire commented 8 years ago

Hmm, it seems like it actually is on Qt5.5

qt5-base 5.5.1-3
qt5-declarative 5.5.1-3
qt5-graphicaleffects 5.5.1-3
qt5-location 5.5.1-3
qt5-multimedia 5.5.1-3
qt5-quickcontrols 5.5.1-3
qt5-script 5.5.1-3
qt5-sensors 5.5.1-3
qt5-svg 5.5.1-3
qt5-webchannel 5.5.1-3
qt5-webkit 5.5.1-3
qt5-x11extras 5.5.1-3
qt5-xmlpatterns 5.5.1-3

Interestingly, I actually have a tray icon now! I did do a reboot or two, so maybe something was just being funky with awesome-wm (I kinda suspected that was the problem child regarding the tray.)

However I am still experiencing the following issue: The popup continues to appear telling me it can't find syncthing in the PATH. I was able to get Preferences open this time, and interestingly it did detect it was already running.

My SyncThing runs on an abnormal port on my desktop (8080, per the package manager's choice, I believe my homebrew installation actually runs on the same port weirdly), and had auth. Once I specified those, I stopped getting the popup. It's a little frustrating because it's hard to get to the settings to fix them though with the popup showing up every 5 seconds.

2015-12-08-203213_506x428_scrot

I have it working now though, so thank you very much! :+1:

sieren commented 8 years ago

Cool! Glad you got it working. :+1: I'll leave this issue open though as a reminder to look into the pop-up showing every 5 seconds. Might need to invalidate some timers there.

sieren commented 8 years ago

Hey, do you mind recreating that scenario with the branch I just merged to master? I believe that should ifx the issue you saw.

johnmaguire commented 8 years ago

@sieren :+1: Just switched my laptop over to port 8080 like my desktop, git pulled and rebuilt, and got no warning popups. :) Path wasn't set, so I think based on the code it's all working correctly.

Just curious, your commit looks like it prevented the popup from showing if path isn't set. If path is set, but incorrect, will it still repeat the popup every few seconds? If so it will be difficult to set the path.

I tried testing by setting the path incorrectly and setting the port incorrectly. No message box. I also stopped Syncthing and relaunched, still no message box.

So I'm a little curious: Is there a scenario where the message box should still be showing up? And might it make more sense to do one of the yellow tooltips instead (since it won't steal focus and prevent me from trying to enter settings.)

Thanks a ton though, this is great!

sieren commented 8 years ago

Hey,

in the new code the message box will only set app when the bool "onSetPath" is set, and the only happens when someone hits enter after the path got typed in. So even if a wrong path is set, it shouldnt happen every few seconds :) I might need to handle this better in the future, i.e. update the path after x amount of seconds of inactivity or even just on closing the settings dialogue (which is what happens now anyway, but fails silently with no message box in case its wrong).

sieren commented 8 years ago

Actually found an easy for for that, thanks for making me re-think this ;)

johnmaguire commented 8 years ago

Awesome! :+1: Well my issues are all fixed, so I'm going to close this. :) Thanks again!