snap integration with XFCE

Didier Roche didrocks at ubuntu.com
Mon Oct 24 09:08:16 UTC 2016


Le 24/10/2016 à 10:58, Eloy García (PC Actual) a écrit :
> Hi Didier!
> 
> Thanks as always for your answer and feedback :) I suspected it and I
> was taking a look to desktop launcher source code on github, but I
> didn't have time to test it. One question: Can I create the symblink
> when the snap application is executed (after installation) via the
> script that i use to wrap up the launching process or will I have
> problems to do that because of the confinement?

No worry :)

As long as your snap has the right plug to access the initial file, this
isn't an issue (and exactly what I'm doing in the desktop launcher for
dconf/gsettings: creating symlink on first launch or after each snap
upgrade if the symlink isn't present).
You can see such an example in
https://github.com/ubuntu/snapcraft-desktop-helpers/blob/master/glib-only/launcher-specific#L37
for instance.

(But yeah, it relies on /home/$USER/ and should probably find a better
way to get user's real home directory. I can't use $HOME as it's
redirected to SNAP_USER_DATA in some cases)


> 
> Best,
> 
> Eloy
> 
> 2016-10-24 10:14 GMT+02:00 Didier Roche <didrocks at ubuntu.com
> <mailto:didrocks at ubuntu.com>>:
> 
>     Le 06/10/2016 à 21:34, Eloy García (PC Actual) a écrit :
>>     Hi all.
>>
>>     I develop a java-based application to download and manage
>>     wallpapers from the Internet (wallpaperdownloader)
>>     (https://bitbucket.org/eloy_garcia_pca/wallpaperdownloader/overview <https://bitbucket.org/eloy_garcia_pca/wallpaperdownloader/overview>).
>>     The applications is in the store but now I'm trying to integrate
>>     XFCE desktop too. I mean, now you can set any wallpaper downloaded
>>     directly from the GUI and it is working fine for GNOME 3, Unity
>>     and MATE. All three of them use gsettings interface and
>>     desktop-gtk3 wrapper part as you can see in the snapcraft.yaml:
>>
>>     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
>>     grade: stable
>>     confinement: strict
>>
>>     apps:
>>       wallpaperdownloader:
>>         command: wallpaperdownloader.sh
>>         plugs: [x11, network-bind, home, gsettings]
>>
>>     parts:
>>       # Pulls the code from the original source (master branch)
>>       # desktop/gtk3 is a snapcraft part (snapcraft-desktop-helpers)
>>     from the Wiki: https://wiki.ubuntu.com/snapcraft/parts
>>     <https://wiki.ubuntu.com/snapcraft/parts>
>>       # It enables desktop integration and gsettings manipulation from
>>     the confined application
>>       # It is necessary to use gsettings interface (see above) in order
>>     to have a fully functional
>>       # desktop/gtk3 part
>>       # Github repository for snapcraft-desktop-helpers:
>>     https://github.com/ubuntu/snapcraft-desktop-helpers
>>     <https://github.com/ubuntu/snapcraft-desktop-helpers>
>>       wallpaperdownloader:
>>         plugin: maven
>>         source: ..
>>         stage-packages:
>>           # mate-desktop-common is necessary to have MATE gsettings schemas
>>     available for the application
>>           - mate-desktop-common
>>         after: [desktop/gtk3]
>>
>>       # 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: dump
>>         source: scripts
>>     Now, if XFCE desktop is detected by the application, the command
>>     run inthe background is 'xfconf-query --channel xfce4-desktop
>>     --property /backdrop/screen0/monitor0/workspace0/last-image --set
>>     wallpaper.jpg'. If the application runs natively, there is no
>>     problem and the wallpaper is set properly. But when I test the
>>     snap package built, this is the error thrown:
>>
>>     ERROR LinuxWallpaperChanger:188 - Property
>>     "/backdrop/screen0/monitor0/workspace0/last-image" does not exist
>>     on channel "xfce4-desktop". If a new property should be created,
>>     use the --create option.
>>
>>     I have included xfconf as stage-package and the command
>>     xfconf-query is found within the snap. Could you give me a hint to
>>     solve this problem?
>>
>>     Thank you very much for your time and your help :)
> 
>     Hey Eloy,
> 
>     I'm not a xfconf user and so can't answer to you precisly. However,
>     my guess is that you will need a file (like the dconf one we are
>     using in GNOME/Unity environment) shared between your user's
>     settings and the snap writable path.
>     The desktop launcher is creating a symlink (accessed via the home
>     interface) between the main user's dconf/user file to path of the
>     snap writable path, to be able to read the value. The gsettings
>     interfaces give, on its side, access to the dbus call for this.
> 
>     I wonder if the unaccessible file/dbus property could trigger this
>     error fallback in xfconf, and hence, prints that message.
> 
>     I hope this helps!
>     Cheers,
>     Didier
> 
> 
>     --
>     Snapcraft mailing list
>     Snapcraft at lists.snapcraft.io <mailto:Snapcraft at lists.snapcraft.io>
>     Modify settings or unsubscribe at:
>     https://lists.ubuntu.com/mailman/listinfo/snapcraft
>     <https://lists.ubuntu.com/mailman/listinfo/snapcraft>
> 
> 
> 
> 
> -- 
> Eloy García Almadén





More information about the Snapcraft mailing list