Launch browser if user clicks on "Launch"

Our application is a simple deamon with web UI. If the user install the snap via “Ubuntu Software” app and then clicks on “Launch” button, the binary is started again. It would be better if instead a browser opens with the address “http://localhost:[port]”. How could this be realized? I have unfortunately found nothing in the documentation.

The “launch” button in Ubuntu Software will attempt to execute the apps entry with the same name as your snap (the default app). The best way to get this to launch a browser is to rename your current apps: app to a different name and add a new entry for the default app that runs usr/bin/xdg-open http://localhost:[port] - you’ll need to install xdg-utils as a stage-packages: item in your snap to get the xdg-open in the snap for you to run. This app entry should include at least the desktop plug, but might need others too.

1 Like