Gnome Shell extension: Syncthing Icon

Hello Syncthing community,

I am using Syncthing for quite some time now and for my own personal needs I have written a tiny shell extension for Gnome 3. It can be found at this GitHub repository. If you are using Gnome 3, please give it a try.

It features a small symbolic Syncthing icon that opens a menu with

  • an on/off switch for starting/stopping Syncthing by utilizing systemd
  • a button for opening the Web user interface
  • a list of folders that are managed by Syncthing

Feedback is very welcome.

Kind regards, Jay

3 Likes

You could add syncthing-inotify.service as well, if it exists.

Hmm, I thought about your suggestion for a while, but I have the feeling that this is not the right place to start/stop syncthing-inotify.

If it really should be started together with syncthing and also stoppped together with syncthing every time, then one could establish this dependency

  • either in the syncthing binary itself
  • or in the corresponding systemd unit files.

Probably you know more about whether this is appropriate for the systemd unit files, as you have written most of them, IIRC.

It is the other way round; when you start syncthing-inotify.service it pulls syncthing.service as a dependency. When you stop syncthing.service unfortunately syncthing-inotify.service keeps running and fails. Since the inotify watcher is an optional “add on”, it makes sense that we do not touch syncthing.service.

I was thinking about sth. like this:

# stop; pseudocode
if (systemctl --user is-active syncthing-inotify.service) && (systemctl --user is-enabled syncthing-inotify.service); then
     systemctl --user stop syncthing-inotify.service
fi

# start; pseudocode
if (systemctl --user is-enabled syncthing-inotify.service); then
    systemctl --user start syncthing-inotify.service 
fi

Otherwise syncthing-inotify.service keeps staying in a strange state when you stop syncthing.service.

edit: This Problem seems to be fixed now… I just tested it again:

$ systemctl --user stop syncthing.service

Sep 25 22:38:54 naboo systemd[1086]: Stopping Syncthing Inotify File Watcher...
Sep 25 22:38:54 naboo systemd[1086]: Stopped Syncthing Inotify File Watcher.
Sep 25 22:38:54 naboo systemd[1086]: Stopping Syncthing - Open Source Continuous File Synchronization...
Sep 25 22:38:54 naboo systemd[1086]: Stopped Syncthing - Open Source Continuous File Synchronization.

So, inotify does stop when syncthing stops. But won’t come up again, when syncthing is restarted.

It’s a good start. However the functions are still limited.

I like this idea! I can’t get it to work, though.

The switch to toggle Syncthing on and off is unresponsive. When I click on the switch, nothing happens.

Is your syncthing listening on port 8384?

Is the switch sensitive and you can toggle it, but Syncthing is not switched on/off in response?

Or is the switch unsensitive, i.e., “grayed out”?

As for the problem with ports other than 8384: I am working on that. Should be fixed in the next release.

Just installed it; it’s pretty neat and that stuff with syncthing-inotify.service works well. :+1:

Okt 07 12:16:34 kronos gnome-shell[1655]: GNOME Shell started at Wed Oct 07 2015 12:16:34 GMT+0200 (CEST)
Okt 07 12:16:40 kronos systemd[1253]: Started Syncthing - Open Source Continuous File Synchronization.
Okt 07 12:16:40 kronos systemd[1253]: Started Syncthing Inotify File Watcher.
Okt 07 12:16:40 kronos syncthing-inotify[22823]: [WARNING] Cannot connect to Syncthing: Get http://127.0.0.1:8384/rest/404: dial tcp 127.0.0.1:8384: connection refused
Okt 07 12:16:40 kronos syncthing[22822]: [35K66] INFO: syncthing v0.12.0-beta2+23-g7e8b76e "Beryllium Bedbug" (go1.5.1 linux-amd64 default) stefan@lap-tatschner.aisec.fraunhofer.de 2015-10-01 09:47:16 UTC
Okt 07 12:16:40 kronos syncthing[22822]: [35K66] INFO: My ID: 35K664T-JVVJ4MZ-NNISZW6-O4QGUOS-PPDK5VK-VGJKMEB-A2XXOI4-6Z3ZIAV
Okt 07 12:16:40 kronos syncthing[22822]: [35K66] INFO: Database block cache capacity 65536 KiB
Okt 07 12:16:41 kronos syncthing-inotify[22823]: [WARNING] Cannot connect to Syncthing: Get http://127.0.0.1:8384/rest/404: dial tcp 127.0.0.1:8384: connection refused
Okt 07 12:16:42 kronos syncthing-inotify[22823]: [WARNING] Cannot connect to Syncthing: Get http://127.0.0.1:8384/rest/404: dial tcp 127.0.0.1:8384: connection refused
Okt 07 12:16:42 kronos syncthing[22822]: [35K66] INFO: Starting deadlock detector with 20m0s timeout
Okt 07 12:16:42 kronos syncthing[22822]: [35K66] OK: Ready to synchronize m-und-s (read-write)
Okt 07 12:16:43 kronos syncthing-inotify[22823]: [WARNING] Cannot connect to Syncthing: Get http://127.0.0.1:8384/rest/404: dial tcp 127.0.0.1:8384: connection refused
Okt 07 12:16:43 kronos syncthing[22822]: [35K66] OK: Ready to synchronize dokumente (read-write)
Okt 07 12:16:43 kronos syncthing[22822]: [35K66] INFO: Completed initial scan (rw) of folder m-und-s

Thank you. :slight_smile: And thank’s for enhancing the service files.

I forgot to mention that the extension can now also be found on extensions.gnome.org.

1 Like

@jimzhong and @jaystrict

Sorry, I should have been more specific. I could move this to a GitHub issue or something if you want.

The Syncthing switch is grayed out.

Screenshot of the Syncthing Icon GNOME Shell extension in action.

I’m running Syncthing v0.11.26 on Fedora 22 (64-bit) with GNOME 3.16.3.

GUI Listen Address: 127.0.0.1:8384
Sync Protocol Listen Address: 0.0.0.0:22000

Let me know if you need any other info.

Yes, please create an issue on GitHub. This is the right place to fix bugs.

Thank you.

Today gnome 3.18 appeared in the arch Linux repos. Is your extension compatible to gnome 3.18?

Yes, it is. Just updated the version information in the GitHub repo.

There seems to be a problem on 3.18:

GLib.FileError: Failed to open file '/home/stefan/.local/share/gnome-shell/extensions/syncthingicon@jay.strict@posteo.de/schemas/gschemas.compiled': open() failed: No such file or directory

Stack trace:
  getSettings@/home/stefan/.local/share/gnome-shell/extensions/syncthingicon@jay.strict@posteo.de/convenience.js:82
  SyncthingIconPrefsWidget<._init@/home/stefan/.local/share/gnome-shell/extensions/syncthingicon@jay.strict@posteo.de/prefs.js:38
  wrapper@resource:///org/gnome/gjs/modules/lang.js:169
  buildPrefsWidget@/home/stefan/.local/share/gnome-shell/extensions/syncthingicon@jay.strict@posteo.de/prefs.js:52
  Application<._selectExtension@resource:///org/gnome/shell/extensionPrefs/main.js:95
  wrapper@resource:///org/gnome/gjs/modules/lang.js:169
  Application<._onCommandLine@resource:///org/gnome/shell/extensionPrefs/main.js:259
  wrapper@resource:///org/gnome/gjs/modules/lang.js:169
  main@resource:///org/gnome/shell/extensionPrefs/main.js:397
  @<main>:1

Did you just copy the files, without compiling the schema? Running ./install.sh should compile it automatically.

Yes; I tried installing via extensions.gnome.org but that seemed to be broken… Anyway, it works now. Thanks!

There is a new version available on extensions.gnome.org.

It now has status indication and config file parsing. Check it out!

2 Likes