Snap package misses /usr/share/[data]

If the aim is to open a pdf in strict confinement, you can open evince by using xdg-desktop-portals functionality, the easiest way to do this would be to simply make a call to xdg-open <path.pdf> in the apps code.

You can give it a quick try with

snap run --shell maitreya8
xdg-open <path-to-pdf>

to see how it would roughly work. It should open up a GUI where the user can select their preferred viewer to open the file.

yes, your understanding is definitely wrong :slight_smile:
snaps allow you to package and run as many apps as you want in one snap, there are no limits here (apart from … well, ram and cpu of the host)

note that “launching a pdf viewer” is not enough to get permissions to upload your snap as classic … what james describes is the corrct way, make the app use xdg-open and it should just work with any modern desktop.

That sounds promising, However the application has a configuration window where it asks you to select the default pdf viewer.It looks for a command path. With strict confinement it does not seem to work. With classic everything works fine but the application complains while using, that it can’t see the /usr/share/maitreya8 folder or any folders within.

I will do exactly as advised by James within strict confinement. I am happy to package evince long with the application within the strict confinement, I would need a way to to let the application call evince as needed. If that can be achieved we are good to go without any need for classic snaps. I will try what James has suggested, I will advise how It goes

1 Like

Just to be sure, you don’t need to package Evince in the snap if you’re expecting users to already have it (or another .pdf viewer, such as basically any web browser). xdg-open will find compatible apps on the host, including any other possible pdf viewers such as Firefox/Chrome/etc

just for the record, here is the list of criteria to get classic confinement allowed by the reviewers:

Thanks @ogra it is really helpful. I will keep working towards making the strict confinement work. Will open a new thread in case I get stuck, I guess the scope of this tread ends here as will no longer face the issue described here in this title, my problem is different now, it concerns launching secondary applications to support the primary one. Many thanks for your valuable guidance.

It has finally worked and I am ready to finally upload my first snap to the store for publishing. I may have to supplement the snap with instructions on how to configure the command line for the pdf editor to point to /bin/xdg-open. That would be there with the description of the snap, i hope that is enough to get this through into the store…Again many thanks for your support.

dont you have a way to put a default config in place that simply includes that command ? (through a command-chain wrapper script or such ?)