Call to chromium-browser from a snap

Hello,
I am pretty new to the snap world and for my application to work, I need to start pages in chromium through a system call “chromium-browser” + some arguments.
When bundling my application in a snap and executing it, I get an error “chromium-browser” not found.
Is there something specific that I need to do for it do work. Including chromium-browser deb in the snap through stage-packages?
I set my app with the following plugs : “plugs: [network, network-bind,browser-support]”
I am running Ubuntu 16.04
Thanks

you should use a call to xdg-open instead …

Thanks for your answer. Can you elaborate a bit more? You suggest that I open the pages I need with xdg-open? This won’t work for my application as I would like to open three tabs with chromium specifically and independently from the default browser configuration. Additionally I pass some flags to chromium in the command. For information, this is how my command looks like (working when my program is executed outside the snap):

chromium-browser --password-store=basic --overscroll-history-navigation=0 --disabled --ignore-certificate-errors  --disable-translate --disable-infobars --disable-suggestions-service --disable-save-password-bubble --kiosk --disable-pinch 'url_tab1?id_X=2&id_Y=4' url_tab2 url_tab3

i fear that is not possible (yet ?) unless you’d ship chrome inside your snap … perhaps portals will allow this, not sure, but the current only way to hand urls so the rest of the system is xdg-open or snapctl user-open which will both only hand the url to the default browser.

I am ok to ship chromium with the snap. Under Ubuntu chromium exists as a deb package (chromium-browser) and as a snap. What will be the easiest to include?
I understand that I will need to use stage-packages for a deb, but what will be the procedure for shipping a snap inside another snap?

i guess including the parts: block from the chroimium snap in your snapcraft.yaml might work (and then calling it with explicit path …). @oSoMoN should be able to point you to the source for it.

alternaively… did you consider using electron or nw.js ?
thats probably easier to ship than a whole browser

There’s also chromium-mir-kiosk that may be of help. Either using the snap directly or borrowing the code?

uh, why is that in the ubuntu community forum instead of the snap forum ? this would have been a good candidate for cross-posting :wink:

The source for the chromium snap built from a deb is here: https://code.launchpad.net/~chromium-team/chromium-browser/+git/snappy-packaging/+ref/stable
There’s also a branch that builds chromium from source, but you probably don’t want to add 10+ hours to your build: https://code.launchpad.net/~chromium-team/chromium-browser/+git/snap-from-source/+ref/stable
That said, at some point in a not-too-distant future the chromium debs will be deprecated in favour of the snap.

Anyway, if your use case is a kiosk-like browser window, you’re probably much better off with a proper kiosk solution, as pointed out by @Saviq, or electron or nw.js, as suggested by @ogra.

I think @greyback recently mentioned to me that he has an experimental electron based kiosk snap somewhere, not sure if thats in a state to show it to others yet though :slight_smile:

@ogra it’s pretty rough, but a basic hello world is here:


We’re working on a tutorial so anyone will be able to snap their electron-based apps for a kiosk, will post when it’s ready.