ipfs-shipyard / go-ipfs-desktop

Other
12 stars 6 forks source link

implement the button to open the web UI #2

Closed mvdan closed 3 years ago

mvdan commented 3 years ago

This is a bit trickier than it sounds, because we want to use the link that ipfs prints when it starts. We also want to open the user's choice of browser; check $BROWSER, then xdg-open, then open, then fall back to common browsers like firefox/chromium/chrome.

joeltg commented 3 years ago

took a first pass at this in bdd456e5cf6e7e1e44938d22cf2b2c17f162ae73 - it just copies the logic from this gist which only calls xdg-open on linux (no looking for $BROWSER or anything).

When does xdg-open not work?

mvdan commented 3 years ago

Be careful because I think your version leaks a bit:

The Wait method will return the exit code and release associated resources once the command exits.

I have code from a previous project that deals with that and also supports a few more edge cases, so I'll just copy-paste that in a second.

When does xdg-open not work?

For the average user, probably never, but it's better to have fallbacks.

mvdan commented 3 years ago

Finished in eff46d518ce952551fd5514e8638a02ca6051355 :)