Yet another Syncthing Tray


(Wolf) #21

Hey.

I find it great that somebody works on things like this, so I thought I might give it a spin.

Just some feedback on the macOS version. I’m running macOS 10.12.6 (the most current one) as a virtual machine. There is nothing installed except the OS and all available updates, the package manager brew and Syncthing in it’s most current version 0.14.36.

The following are just my very personal observations. Maybe totally wrong, though I try to explain my thoughts…

Downloaded syncthingtray-devel-242-c8b68bc7-static-x86_64-apple-darwin15.tar.xz from https://martchus.no-ip.biz/repo/mac
Seems to be the most current one.

The tar file cannot be uncompressed by double-clicking. A larger part of Mac users would now be lost, I assume.
Unpacked the tar with 'tar xzf syncthingtray*.xz’ Two results:
…- syncthingctl…9MB
…- syncthingtray.app…25,5MB
The latter is an application bundle with a generic icon (no .app/Contents/Resource/.icns-file).
All binaries have executable rights. (755)


Double-Clicking syncthingtray.app fails more or less silently. Since it crashed, macOS fires up the CrashReporter and offers to send some info to Apple. Certainly no need for that.

The console is not much more verbose either:

standard	17:21:09.636279 +0200	opendirectoryd	Client: <private>, UID: 0, EUID: 0, GID: 0, EGID: 0
standard	17:21:09.636525 +0200	opendirectoryd	Client: <private>, UID: 0, EUID: 0, GID: 20, EGID: 20
standard	17:21:09.637179 +0200	opendirectoryd	Client: <private>, UID: 501, EUID: 501, GID: 20, EGID: 20
standard	17:21:09.644230 +0200	CommCenter	#I CSIAppInfo.ApplicationActivationObserver: handleLSNotitifcation_sync: Application launched: <private>
standard	17:21:09.647897 +0200	taskgated	MacOS error: -67062
error	    17:21:09.664069 +0200	ReportCrash	Failed to start process notifications for pid 1849 (16)

From what I understand:
…- opendirectory: The app (which is a bundle, read: directory) is started by walking synchingtray.app/Contents/MacOS/ and then executing the binary ‘syncthingtray’ with the credentials of the current userid 501.

…- commcenter: The subsystem com.apple.CommCenter is called to register the app with the parameters ‘#I CSIAppInfo.ApplicationActivationObserver: handleLSNotitifcation_sync: Application launched: AppInfo[syncthingtray, , true, 501, 0]’

…- Crash. It crashed when taskgated throws an error. That is the subsystem com.apple.Securityd coughing up a security_exception with error -67062

To enable a little more detailed log (haha, as if the system log isn’t flooding enough data) I’ve turned on to show all private data (sudo log config --mode “private_data:on”) but that didn’t yield much.

Multiple tries all had the same result.


Next was the cli version ‘syncthingctl’ (shouldn’t that be called ‘syncthingtraycli’?).

Calling just the binary fails with:

QFSFileEngine::open: No file name specified
Error: Unable to locate Syncthing config file and no API key specified

./syncthingctl -? yields:

Abort trap: 6

./syncthingctl --help shows the help.
The only parameters that sound as if they might be necessary are
…- config-file
…- api-key
…- url
I would have expected syncthingcli to try the defaults automatically, but maybe not. So…

./syncthingctl -config-file $HOME/Library/Application\ Support/Syncthing/config.xml
Same error as above.


For now I can’t get this to work at all.

Is the tar really everything that needs to be installed? Are there prerequisites like frameworks necessary? Can I test anything else?


#22

Yes, the version scheme for devel builds is "$(git rev-list --count HEAD)-$(git rev-parse --short HEAD)".

I did not know that. Which (preferably equally efficient) format is common among Mac OS X users?

Adding an icon and maybe some other meta-data would be nice of course.

I can do nothing more than a search about this. Looks like the application is invoked incorrectly, maybe a permission error.

  • What happens if you ignore all the bundle stuff and just start the application from a console (not sure whether you have already tried the “ignore the bundle stuff” part)?
  • Does at least ./syncthingtray --help work?
  • What happens if you start it with ./syncthingtray qt-widgets-gui --windowed?

It is called “syncthingctl” in analogy to systemd tools (systemctl, journalctl, …). Besides, this application has nothing to do with the system tray.

The first line is produced by Qt I guess. Seems like the CLI is not able to locate the Syncthing config under Mac OS X. I’m using Qt/QStandardPath to locate the file. Seems like there is a Mac specific implementation required.

Likely the equivalent of SIGSEGV under Mac OS X. Under Linux I would make a debug build and use gdb to investigate. Here all I can do is guessing.

That’s actually the right expectation.

You should specify an operation (eg. status). Additionally, it must be --config-file (two dashes at the beginning of the argument).

Does is work if you omit the config file completely, eg. syncthingctl status --url http://localhost:yourport --api-key yourkey? (The config file is just used to read URL, API key and credentials automatically.)

What I’ve learned so far is that one can use otool -L under Mac OS to check for required dependencies (equivalent of eg. readelf -d under Linux). But I think if one dependency would be missing, you would get an error message indicating that (at least this would be the case under Linux and Windows).

/opt/osxcross/bin/x86_64-apple-darwin15-otool -L bin/syncthingtray.app/Contents/MacOS/syncthingtray
bin/syncthingtray.app/Contents/MacOS/syncthingtray:
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1225.1.1)
        /usr/lib/libiconv.2.dylib (compatibility version 7.0.0, current version 7.0.0)
        /System/Library/Frameworks/CoreWLAN.framework/Versions/A/CoreWLAN (compatibility version 1.0.0, current version 1.0.0)
        /usr/lib/libcups.2.dylib (compatibility version 2.0.0, current version 2.11.0)
        /System/Library/Frameworks/ApplicationServices.framework/Versions/A/ApplicationServices (compatibility version 1.0.0, current version 600.0.0)
        /System/Library/Frameworks/Security.framework/Versions/A/Security (compatibility version 1.0.0, current version 57336.1.9)
        /System/Library/Frameworks/SystemConfiguration.framework/Versions/A/SystemConfiguration (compatibility version 1.0.0, current version 801.1.1)
        /System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL (compatibility version 1.0.0, current version 1.0.0)
        /System/Library/Frameworks/AGL.framework/Versions/A/AGL (compatibility version 1.0.0, current version 1.0.0)
        /System/Library/Frameworks/Carbon.framework/Versions/A/Carbon (compatibility version 2.0.0, current version 157.0.0)
        /System/Library/Frameworks/DiskArbitration.framework/Versions/A/DiskArbitration (compatibility version 1.0.0, current version 1.0.0)
        /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit (compatibility version 1.0.0, current version 275.0.0)
        /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation (compatibility version 300.0.0, current version 1252.0.0)
        /System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices (compatibility version 1.0.0, current version 728.4.0)
        /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit (compatibility version 45.0.0, current version 1404.0.0)
        /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1253.0.0)
        /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.5)
        /usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0)

You could test the Tag Editor which is found on the same page as the binary for Syncthing Tray. I built it using the same configuration and has common code. However, it does less problematic things (like showing a tray icon) at startup. So maybe at least the CLI of it works (eg ./tageditor get -f somefile.m4a). If it also just yields Abort trap: 6 the issue is likely in the common code (c++utilities or qtutilities library or maybe even Qt or libstdc++).


Thanks for feedback so far. Seems like it is not as easy as just cross-compiling everything. Likely I’m not able to fix these run-time issues myself. Since the issues preventing the build are now solved, someone interested in a Mac version could try to investigate the run-time issues.

Here (again) the link for my build configuration and the commands I’ve used to build Syncthing Tray for Mac OS X: https://github.com/Martchus/cpp-utilities/issues/4#issuecomment-321914453

It should also work to use the official Qt version when not cross compiling (so you don’t have to build it yourself). For debugging I usually use Qt Creator (not sure whether it supports the debugger commonly used under Mac OS).


(Wolf) #23

Output of otool for syncthingctl:

$ /Library/Developer/CommandLineTools/usr/bin/otool -L ~/Downloads/syncthingctl

/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1225.1.1)
/usr/lib/libiconv.2.dylib (compatibility version 7.0.0, current version 7.0.0)
/System/Library/Frameworks/Security.framework/Versions/A/Security (compatibility version 1.0.0, current version 57336.1.9)
/System/Library/Frameworks/SystemConfiguration.framework/Versions/A/SystemConfiguration (compatibility version 1.0.0, current version 801.1.1)
/System/Library/Frameworks/CoreWLAN.framework/Versions/A/CoreWLAN (compatibility version 1.0.0, current version 1.0.0)
/System/Library/Frameworks/DiskArbitration.framework/Versions/A/DiskArbitration (compatibility version 1.0.0, current version 1.0.0)
/System/Library/Frameworks/IOKit.framework/Versions/A/IOKit (compatibility version 1.0.0, current version 275.0.0)
/System/Library/Frameworks/Foundation.framework/Versions/C/Foundation (compatibility version 300.0.0, current version 1252.0.0)
/System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices (compatibility version 1.0.0, current version 728.4.0)
/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit (compatibility version 45.0.0, current version 1404.0.0)
/System/Library/Frameworks/ApplicationServices.framework/Versions/A/ApplicationServices (compatibility version 1.0.0, current version 48.0.0)
/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1253.0.0)
/usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.5)
/usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0)

Looks as if everything is there.


Output of otool -L for syncthingtray.app

$ /Library/Developer/CommandLineTools/usr/bin/otool -L ~/Downloads/syncthingtray.app/Contents/MacOS/syncthingtray

/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1225.1.1)
/usr/lib/libiconv.2.dylib (compatibility version 7.0.0, current version 7.0.0)
/System/Library/Frameworks/CoreWLAN.framework/Versions/A/CoreWLAN (compatibility version 1.0.0, current version 1.0.0)
/usr/lib/libcups.2.dylib (compatibility version 2.0.0, current version 2.11.0)
/System/Library/Frameworks/ApplicationServices.framework/Versions/A/ApplicationServices (compatibility version 1.0.0, current version 600.0.0)
/System/Library/Frameworks/Security.framework/Versions/A/Security (compatibility version 1.0.0, current version 57336.1.9)
/System/Library/Frameworks/SystemConfiguration.framework/Versions/A/SystemConfiguration (compatibility version 1.0.0, current version 801.1.1)
/System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL (compatibility version 1.0.0, current version 1.0.0)
/System/Library/Frameworks/AGL.framework/Versions/A/AGL (compatibility version 1.0.0, current version 1.0.0)
/System/Library/Frameworks/Carbon.framework/Versions/A/Carbon (compatibility version 2.0.0, current version 157.0.0)
/System/Library/Frameworks/DiskArbitration.framework/Versions/A/DiskArbitration (compatibility version 1.0.0, current version 1.0.0)
/System/Library/Frameworks/IOKit.framework/Versions/A/IOKit (compatibility version 1.0.0, current version 275.0.0)
/System/Library/Frameworks/Foundation.framework/Versions/C/Foundation (compatibility version 300.0.0, current version 1252.0.0)
/System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices (compatibility version 1.0.0, current version 728.4.0)
/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit (compatibility version 45.0.0, current version 1404.0.0)
/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1253.0.0)
/usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.5)
/usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0)

Looks fine as well.


Starting syncthingctl directly as suggested:

$ ./syncthingctl status --url http://localhost:8090 --api-key blah

QFSFileEngine::open: No file name specified
Error: Unable to parse Syncthing config: illegal value

Hm. Why is it trying to parse the config if I don’t point it to a config…
And what exactly is the illegal value…


Starting syncthingtray.app/Contents/MacOS/syncthingtray binary:

~/Downloads/syncthingtray.app/Contents/MacOS $ ./syncthingtray --help

Syncthing Tray, version 0.6.3-242.c8b68bc
Linked against: C++ Utilities: 4.9.2-357.a40d6ca, Qt Utilities: 5.7.1-176.7c6483f, Connection backend of Syncthing Tray: 0.6.3-242.c8b68bc, Data models of Syncthing Tray: 0.6.3-242.c8b68bc, Widgets of Syncthing Tray: 0.6.3-242.c8b68bc, Qt Network: 5.9.1, Qt Widgets: 5.9.1, Qt Core: 5.9.1
Available arguments:
....

Works.

~/Downloads/syncthingtray.app/Contents/MacOS $ ./syncthingtray qt-widgets-gui --windowed

Unable to load translation file for Qt repository "" and language de_DE.
Unable to load translation file for "qtutilities" and the language "en_US".
Unable to load translation file for "syncthingconnector" and the language "en_US".
Unable to load translation file for "syncthingtray" and the language "en_US".

WORKS! At least a dialog is opened. Nothing happens much after that, but its a step in the right direction.


Testing Tag Editor

Starting it via Double-Klick does nothing.
But ~/Downloads/tageditor.app/Contents/MacOS $ ./tageditor

Unable to load translation file for Qt repository "" and language de_DE.
Unable to load translation file for "qtutilities" and the language "en_US".

Works! It brings up the mp3 Tag Editor. I would’ve tried it out, but my mp3s are on a different volume (mounted automatically unter /Volumes by macOS) which is not available. But looks good.


Things look very good. Still rough, but that was to be expected when developing for a foreign platform. :slight_smile:


#24

Thanks for taking the time :slightly_smiling_face:

This error is not about parsing the XML configuration file of Syncthing. The application now actually tries to communicate with Syncthing. However, the config it has been received via the REST API is not valid JSON. Likely because the request was not done correctly. I should improve the error handling here to show the request and the response.

I assume that dialog looks similar to the screenshot in the first post of this thread? If not, which dialog do you get exactly?

So the tray icon does not work but the application itself would at least show up.

So you can not open the settings to let it connection to Syncthing?

So the bundle does not work. Maybe I can check how other CMake projects do it.

So including translations didn’t work too well.

BTW: The Tag Editor is not limited to MP3 (it also supports iTunes-style AAC/M4A, Matroska, …).

So the file system model provided by Qt behaves differently under Mac OS. And not even the “Open file dialog” accessible via “File -> Open” in the menu allows you to pick select the file? That would be a problem for Syncthing Tray, too. Actually, the applications should show the native Mac OS X file dialog.


#25

New release 0.6.3 is available.

  • Again some fixes and small improvements.
  • I also updated the static Windows binaries.
  • This version also should at least compile for MacOS X. So anyone interested in a Mac version could try to build it and investigate/debug run-time issues. The improved error logging might also help.
  • I also started to work on a Plasmoid (widget for Plasma 5 desktop). It is still incomplete and experimental.

Full list of changes: https://github.com/Martchus/syncthingtray/compare/v0.6.2...v0.6.3


#26

Here a few more screenshots showing the Plasma 5 integration (Plasmoid and Dolphin menu):


#27

New release 0.7.0 is available.

  • Fix some bugs (as always)
  • Improve the CLI syncthingctl, eg. Bash completion now also completes directory/device names
  • Allow re-ordering connection configurations
  • Plasmoid should be usable now
  • Other small improvements

Full list of changes: https://github.com/Martchus/syncthingtray/compare/v0.6.3...v0.7.0


#28

New release 0.7.1 is available.

  • Fix some bugs (mostly concerning the Plasmoid)
  • Allow turning use of escape sequences off
  • Show native directory selection when double-clicking on directory input on web UI

Full list of changes: https://github.com/Martchus/syncthingtray/compare/v0.7.0...v0.7.1


Syncthing is the BEST! Help me detect "Up to Date" with REST
#29

New release 0.7.2 is available.

Full list of changes: https://github.com/Martchus/syncthingtray/compare/v0.7.1...v0.7.2


Proper way for "Sync complete" notification and actual idle detection
#30

New release 0.7.3 is available.

Full list of changes: https://github.com/Martchus/syncthingtray/compare/v0.7.2...v0.7.3

(Does not fix the problems mentioned in Proper way for "Sync complete" notification and actual idle detection yet.)


(totoba) #31

Hi

Can you also provide Debian debs? I wanted to try but it is a bit involved for my skills to get that going.

thanks


#32

@totoba See https://github.com/Martchus/tageditor/issues/33#issuecomment-362812955

Note that “stable” Debian often provides very outdated packages. For Syncthing Tray I would recommend to use Qt 5.9 or newer and I’m not sure whether Qt < 5.8 is still sufficient.


(totoba) #33

No pressure, but why not provide an app image like Krita does?

https://krita.org/en/download/krita-desktop/


#34

@totoba That is definitely worth a thought.


(totoba) #35

Look what Linus said about it :wink:

Linus Torvalds

This is just very cool.

Anyway I think it would be nice if it was more accessible. I would like to use it for sure.


#36

Yes, I’m currently reading their README. This seems to involve packaging all dependencies, including Qt. The tool linuxdeployqt might be helpful.

I suppose the following features will not be possible, though:

  • Dolphin integration
  • Plasmoid for Plasma 5 desktop
  • using any Qt Widget theme provided by the distribution
  • further integration for desktop environments (eg. GTK or KDE file dialogs)

#37

I created an AppImage using OBS. It is actually not more than a few lines.

Due to an issue with OBS/AppImage the build currently fails.
I could fix this locally, though. My builds for the latest Git commit are available here: https://martchus.no-ip.biz/repo/AppImage/2018-02-10

Limitations:

  1. only x86_64 build available so far
  2. creating a menu entry is not implemented so far
  3. adding the tray to auto-start via settings does not work (it is currently trying to add the temporarily mounted executable rather than the AppImage path)
  4. The CLI syncthingctl is not available (creating an AppImage seems to require a *.desktop file)
  5. no Wayland platform plugin included so far
  6. Bash completion not possible
  7. Dolphin integration not possible
  8. Plasmoid not possible
  9. using custom Qt Widgets style not possible
  10. no further integration for desktop environments (eg. GTK or KDE file dialogs)
  11. the bundled Qt is quite old because those AppImages are supposed to be built under old distributions for better compatibility
  12. Despite 11., it might not work under very old distributions.

I think that only 1. to 5. could be implemented or worked around.


#38

The CLI developed as side-project of this tray will finally support changing the configuration in the next release.

Since it is hard to provide a nice CLI interface for modifying nested data structures like the Syncthing config, I decided just to open an editor like systemctl edit ... does. But this seemed a bit too boring, so I also implemented a options which allow to modify the configuration by running JavaScript code like this example.

syncthingctl --help:

cat
  prints the current Syncthing configuration

edit
  allows editing the Syncthing configuration using an external editor
  --editor [editor name] [editor option] ...
    specifies the editor to be opened
    default environment variable: EDITOR
  --script [path]
    runs the specified UTF-8 encoded ECMAScript on the configuration rather than opening an editor
  --js-lines [line] ...
    runs the specified ECMAScript lines on the configuration rather than opening an editor
  --dry-run
    writes the altered configuration to stdout instead of posting it to Syncthing

Like any other commands of the CLI, it works for remote instances as well (by specifying the --url argument).


#39

New release 0.8.0 is available.

  • As already mentioned, syncthingctl can now modify the configuration.
  • There are notifications for new folders or devices.
  • Sync complete notification now uses FolderCompletion event.

Full list of changes since v0.7.3: https://github.com/Martchus/syncthingtray/compare/v0.7.3...v0.8.0


(Garth) #40

Hi, how do I go about building the latest version for windows?