Access to other commands

Zygmunt Krynicki zygmunt.krynicki at
Thu Sep 8 07:30:22 UTC 2016

> On 8 Sep 2016, at 09:17, Eloy García (PC Actual) <eloy.garcia.pca at> wrote:
> Hi all.
> I currently have several problems with my snap package for wallpaperdownloader application, a java-based piece of software that downloads wallpapers from the Internet, and maybe this is the solution for some of them.
> In this application, I execute some Linux command tools such as xdg-open and gsettings. They work flawlessly within a "native" environment, but when I try to execute them inside the snap package, they simply don't work.
> Gustavo, when you suggest to use the line: bus-send --print-reply --session --dest=com.canonical.SafeLauncher / com.canonical.SafeLauncher.OpenURL string:"$1"
> could you give an example of that? I mean, if I want to, for example, open a browser using "xdg-open" executing this command from my Java code, what would be the line I should use instead?. This implies to modify my java code too and I had to do the distinction between the application executed in a native environment and in a snap confinement. This wouldn't be the desired way of packaging the app. Would be possible to use some kind of interface to have access to the "native" command line tools installed in the system? This way, source code would be agnostic (I mean, I didn't have to tweak the application depending on the environment executed) and it would be only a matter of snapcraft.yaml configuration.

I believe there’s a special version of xdg-open that does exactly what that bus-send line above is doing.

You can add a part to your snap that includes this executable so that all the other code in your snap can remain the same.

Best regards

More information about the Snapcraft mailing list