I'm building a snap package for my application which is java-based and downloads wallpapers from the Internet. So far so good, but now I'm adding a new feature to set the wallpaper selected and it doesn't work. This feature is implemented for Unity and Gnome 3 desktops, which provide an easy way of setting desktop wallpaper via gsettings command line tool.
This way, executing gsettings set org.gnome.desktop.background picture-uri file://blablabla.jpg you can change the desktop wallpaper directly, and my java-based application is using this tool and this command to achieve this goal.
First, when I tested wallpaperdownloader within a snap package, it complained because it didn't find gsettings binary within the snap. Now it is fixed, because I have included libglib2.0-bin as a stage package. Nevertheless, it doesn't work. I guess gsettings inside snap package cannot manipulate files outside the snap, and I need to directly modify those files within user's home directory. Can I achive this or it is restricted?
These are the files snapcraft.yaml and the script executed when wallpaperdownloaded is launched
name: wallpaperdownloader version: "2.2" summary: Download and manage your favorite wallpapers from the Internet description: WallpaperDownloader is a simple GUI Java based application for downloading and managing wallpapers from the Internet confinement: strict apps: wallpaperdownloader: command: wallpaperdownloader.sh plugs: [x11, network-bind, home] parts: # Pulls the code from the original source (master branch) wallpaperdownloader: plugin: maven source: . stage-packages: - libglib2.0-bin # It will copy wallpaperdownloader script into /bin/ # This script contains all the commands needed (sets env variables, launches the jar file...) to # execute the application exec: plugin: copy files: wallpaperdownloader.sh: bin/wallpaperdownloader.sh
#!/bin/sh # Only for packaging! # Script for snap packaging wallpaperdownloader application. It is not related to the code itself # Not good, needed for fontconfig export XDG_DATA_HOME=$SNAP/usr/share # Font Config export FONTCONFIG_PATH=$SNAP/etc/fonts/config.d export FONTCONFIG_FILE=$SNAP/etc/fonts/fonts.conf export HOME=$SNAP_USER_DATA java -jar -Duser.home=$SNAP_USER_DATA $SNAP/jar/wallpaperdownloader.jar
P.S.: I've tried gsettings and unity7 plugins but they didn't work althoug I only included them in snapcraft.yaml file and I didn't apply any tweak/configuration.
Thank you very much,