I created a snap for Foliate, a gjs-based e-reader. One thing that puzzles me is that the app crashes if I don’t add a dbus slot. A quick search through the Foliate source code doesn’t give any results for dbus: https://github.com/johnfactotum/foliate/search?q=dbus&unscoped_q=dbus
This is the error message:
Failed to register: GDBus.Error:org.freedesktop.DBus.Error.AccessDenied: An AppArmor policy prevents this sender from sending this message to this recipient; type="method_call", sender=":1.148" (uid=1000 pid=24543 comm="/snap/foliate/current/usr/bin/gjs /snap/foliate/x1" label="snap.foliate.foliate (enforce)") interface="org.freedesktop.DBus" member="RequestName" error name="(unset)" requested_reply="0" destination="org.freedesktop.DBus" (bus)
Request for dbus access, titania implies that it is expected for GTK applications to require dbus access. Why is this? Can I request access for Foliate? Since this is the application used for the GTK3 Applications tutorial, I’d like to be able to explain to readers why this access is necessary.
slots:
dbus-daemon:
interface: dbus
bus: session
name: com.github.johnfactotum.Foliate
This is the full snapcraft.yaml:
name: foliate
version: 'git'
grade: stable
adopt-info: foliate
base: core18
confinement: strict
slots:
dbus-daemon:
interface: dbus
bus: session
name: com.github.johnfactotum.Foliate
apps:
foliate:
command: usr/bin/com.github.johnfactotum.Foliate
extensions: [gnome-3-28]
plugs:
- gsettings # For desktop theme detection under Wayland session
- home
slots:
- dbus-daemon
common-id: com.github.johnfactotum.Foliate
desktop: usr/share/applications/com.github.johnfactotum.Foliate.desktop
parts:
foliate:
plugin: meson
source: https://github.com/johnfactotum/foliate.git
source-branch: 1.x
meson-parameters: [--prefix=/snap/foliate/current/usr]
build-packages:
- libgjs-dev
- gettext
override-pull: |
snapcraftctl pull
# Point to the snapped version of gjs
sed -i.bak -e 's|@GJS@|/snap/foliate/current/usr/bin/gjs|g' src/com.github.johnfactotum.Foliate.in
# Point icon to the correct location
sed -i.bak -e 's|Icon=com.github.johnfactotum.Foliate|Icon=/usr/share/icons/hicolor/scalable/apps/com.github.johnfactotum.Foliate.svg|g' data/com.github.johnfactotum.Foliate.desktop.in
organize:
snap/foliate/current/usr: usr
parse-info: [usr/share/metainfo/com.github.johnfactotum.Foliate.appdata.xml]
libraries:
plugin: nil
stage-packages:
- gjs
- gir1.2-webkit2-4.0