From various examples, I’ve seen the following plug in a snapcraft.yaml
file:
plugs:
gnome-3-28-1804:
interface: content
target: gnome-platform
default-provider: gnome-3-28-1804:gnome-3-28-1804
gtk-3-themes:
interface: content
target: $SNAP/share/themes
default-provider: gtk-common-themes:gtk-3-themes
icon-themes:
interface: content
target: $SNAP/share/icons
default-provider: gtk-common-themes:icon-themes
sound-themes:
interface: content
target: $SNAP/share/sounds
default-provider: gtk-common-themes:sounds-themes
But when I used that in my snapcraft.yaml file, the GTK icons for my app wouldn’t show.
So, I made a small change that fixed it. I had to modify the target path, so that it would point to: $SNAP/usr/share… (so I added /usr to the paths).
So mine looks like this now, and it works:
plugs:
gnome-3-28-1804:
interface: content
target: gnome-platform
default-provider: gnome-3-28-1804:gnome-3-28-1804
gtk-3-themes:
interface: content
target: $SNAP/usr/share/themes
default-provider: gtk-common-themes:gtk-3-themes
icon-themes:
interface: content
target: $SNAP/usr/share/icons
default-provider: gtk-common-themes:icon-themes
sound-themes:
interface: content
target: $SNAP/usr/share/sounds
default-provider: gtk-common-themes:sounds-themes
My question is: why did I need to change it to $SNAP/usr/share…to get it to show GTK icons? All the examples I’ve seen just have $SNAP/share… ? Am I doing this correctly?
My full snapcraft.yaml is:
name: openresizer # you probably want to 'snapcraft register <name>'
base: core18 # the base snap is the execution environment for this snap
version: '1.0' # just for humans, typically '1.2+git' or '1.3.2'
summary: Batch image resizer with a GUI # 79 char long summary
description: |
OpenResizer is an open-source batch image resizing software with a GUI.
It is designed to be fast and easy-to-use.
grade: devel # must be 'stable' to release into candidate/stable channels
confinement: devmode # use 'strict' once you have the right plugs and slots
icon: gui/openresizer.png
architectures:
- build-on: [amd64, i386]
run-on: all
plugs:
gnome-3-28-1804:
interface: content
target: gnome-platform
default-provider: gnome-3-28-1804:gnome-3-28-1804
gtk-3-themes:
interface: content
target: $SNAP/usr/share/themes
default-provider: gtk-common-themes:gtk-3-themes
icon-themes:
interface: content
target: $SNAP/usr/share/icons
default-provider: gtk-common-themes:icon-themes
sound-themes:
interface: content
target: $SNAP/usr/share/sounds
default-provider: gtk-common-themes:sounds-themes
parts:
desktop-gtk3:
build-packages:
- build-essential
- libgtk-3-dev
make-parameters:
- FLAVOR=gtk3
plugin: make
source: https://github.com/ubuntu/snapcraft-desktop-helpers.git
source-subdir: gtk
stage-packages:
- libxkbcommon0
- ttf-ubuntu-font-family
- dmz-cursor-theme
- light-themes
- adwaita-icon-theme
- gnome-themes-standard
- shared-mime-info
- libgtk-3-0
- libgdk-pixbuf2.0-0
- libglib2.0-bin
- libgtk-3-bin
- unity-gtk3-module
- libappindicator3-1
- locales-all
- xdg-user-dirs
- ibus-gtk3
- libibus-1.0-5
- fcitx-frontend-gtk3
override-build: |
snapcraftctl build
mkdir -pv $SNAPCRAFT_PART_INSTALL/gnome-platform
main-part:
# See 'snapcraft plugins'
plugin: python
python-packages:
- pillow
stage-packages:
- python3-gi
#- appmenu-gtk3-module
openresizer:
plugin: dump
source: https://github.com/jrezai/openresizer.git
source-type: git
after: [desktop-gtk3]
organize:
glade_files: bin/glade_files
gui: bin/gui
override-pull: |
snapcraftctl pull
chmod +x bin/openresizer.py
apps:
openresizer:
command: desktop-launch $SNAP/bin/openresizer.py
environment:
XDG_DATA_DIRS: $SNAP/usr/share:$XDG_DATA_DIRS
plugs: [gnome-3-28-1804, x11, unity7, pulseaudio, wayland, desktop, desktop-legacy, gsettings, home, removable-media]
desktop: bin/gui/openresizer.desktop