Is there a way to run a command on the hostsystem from a with snap installed Application?

Hello

Is there a way to allow acces to the hostsystem so i can execute commands in my hostsystem from a with snap installed Application (with strict mode)?

I have not yet found a way.

Greetings

No, because then it wouldn’t be confined and secure (strict mode). Include what you need to run in snap or request classic (no confinement) in store-requests but you better have a good reason for it.

thank you for your answer.

I have to refrain from snapstore.

Greetings

What are you trying to snap?

Which commands do you want/need to run?

DailyDesktopWallpaperPlus

Include gsettings interface in plugs: to get access to that but I don’t know how you would detect host system desktop environment to know it’s Gnome or KDE. I don’t know how to execute other commands.

Also in code I see you create bash script in application directory which is read only so that is not going to work. Change location of that file to some snap writable directory or change app to use dbus directly.

Hello predr,
thank you for your answer!
Yes, I have also considered this (the dbus and gsettings interface).

But the problem is:
i’ll set the wallpaper automatically on other desktops (e.g. LXDE, LXQT, and on KDE 3.x/TDE).

And there are not possible to change the wallpaper on KDE 3.x and Trinity Desktop Environment with dbus (only with the dcop command)…

i want using the commands “dcop” and “pcmanfm” to change the wallpaper on KDE3.x/TDE Desktops and LXDE…

Greetings

That sounds like a task for the desktop portal, specifically there’s a wallpaper interface https://flatpak.github.io/xdg-desktop-portal/portal-docs.html#gdbus-org.freedesktop.portal.Wallpaper This is already covered by the desktop interface.

However, I’m not sure those desktop environments support desktop portal. Perhaps they do. If not I’m sure there’s a way to work with respective upstreams to get the things you need.

Thank you. That looks interesting.