Command to open app in browser on exec

Apr 4, 2025 Closed
D

Not sure is this related to Flatpak, but maybe I can make platform-independent request to open http://locahost:port in browser, as my client currenlty implements web interface only.

Or it’s better to execute the app with the launcher.sh?

Thanks

C

Is general, you want to use the OpenURI portal to ask the system to open your address with the user-preferred browser.

That being said, you mention that:

If the only UI is a web interface, having it run in its own window makes more sense from a UX perspective. OpenURI is intended if you want to open a web URI outside of your application.

D
Replying to #2

Thanks, that is really useful for developers.

I’m currently using shell script to launch the app,
so according to your tip, implemented like that and it works:

xdg-open http://localhost:28332

Or the OpenURI API could be useful from bash?

C
Replying to #3

xdg-open uses the portal on Flatpak, so it should be fine. The OpenURI API is when you want to call it from a program.

That being said, you might want to consider using something like Electron or Tauri to present the app in its own window. Having the app launch in a browser is unconventional UX.