How do I open Syncthing in a different browser? (Linux)

I don’t think syncthing has a -browser flag that would let me open it in a different browser. Can someone suggest me what to do, or help me write a script which can generate a headless syncthing instance and then launch it in another browser?

For information, my default browser is Firefox but I want syncthing to start in Surf, to help me save on some resources.

You can’t make syncthing launch a different browser, it always launches the default browser, if you want Surf to be opened, then make surf your default browser and open firefox manually for browsing.

In general, you can make it not start a browser, and manually navigate to 127.0.0.1:8384

1 Like

I tried writing a script to do just that but I couldn’t get it to work. Should I make this a feature request in Syncthing’s Github?

No. What would that feature request be for? What about Audrius suggestion of starting syncthing without a browser and then opening the web ui in surf clear/doesn’t work?

You haven’t stated the platform you’re on or what your requirements are, so it’s not really clear what you want.

Still, I’ve made an example bash script that opens surf after launching syncthing. Syncthing is launched in a daemonized screen program and surf is launched in the current shell. Note that when the shell exits, surf is also killed. If you don’t want that behavior you need to specify what your intended behavior is. If you’re already starting syncthing via systemd or something, you should instead modify your systemd script.

#!/bin/bash
screen -dmS syncthing syncthing -no-browser
sleep 5 # Wait for GUI to come online
surf http://127.0.0.1:8384

screen is a program that you may need to install on your system first. It has the nice benefit that it can easily daemonize stuff while also preserving the ability to read/write to stdin/stdout of the process, by attaching or detaching from the screen.

Of course there are many more possibilites, which mostly depends on how you’re starting syncthing. Anway, the general concept is: Launch syncthing, then open your browser.

I’m not sure what you mean by platform but I am using Arch Linux. I wrote this script for myself:

#!bin/env/bash
syncthing -no-browser
sleep 5
surf <required url>

However that doesn’t work. The command line shows normal output as when I run syncthing by itself, but the surf window never appears.

Another thing I have noticed is that when I run syncthing -no-browser and then surf <required url> as two different commands then everything works just fine.

This just launches syncthing and waits for it to terminate, which it never does. You can add a & disown to the syncthing command to try and fix that.

2 Likes

Arch Linux is using systemd, so you can also launch Syncthing via systemd, e.g. as user unit (systemctl --user start syncthing.service).

I tried this and well it doesn’t work. Surf says couldn’t resolve and connect to host.

Edit: I tried the & disown method that Audrius suggested and it works! Thank you very much!

in Surf can you bookmark 127.0.0.1:8384 ?

1 Like

Yeah I can. That’s actually a really good idea. Never struck me. Thanks!

1 Like