Snaps on Unity7 and app-indicators
Marco Trevisan
marco.trevisan at canonical.com
Fri Dec 2 15:38:56 UTC 2016
Hello snapcrafters,
As you might have noticed, snap packages that are including
app-indicators won't generally show the proper icon in unity(7, as the 8
has not support for them at all yet) [see https://pad.lv/1600136]. The
main reasons for this issue was that apps generally try to refer to
custom indicator icons saving them in /tmp (for QT apps, and snap's /tmp
is something not accessible from outside) or in a prefix that doesn't
take in account the $SNAP path (including a custom indicator-theme-path).
Few days ago I finalized some tweaks for libappindicator (gtk2/gtk3)
sni-qt (qt4) and appmenu-qt5 (qt5) which should allow packaging of many
apps without thinking too much about whether they're running in snap or not.
You can see some examples here:
- https://github.com/3v1n0/indicators-examples-snaps
Basically, until the various 'desktop-<toolkit>' parts (which will
happen once [1] will hit the parts server and xenial archives) won't
include this, you only have to add 'indicator-<toolkit>' (defined in
[2]) to the 'after' entry of your part.
This should work in most of cases.
However there are still couple of known issues:
1) Gtk apps using libappindicator aren't working with snapd 2.17 because
of some missing confinement policies (fixed in [3], included in 2.18),
but if you want to use your snap confined in the mean time, you can just
apply this:
wget -qO- https://github.com/jdstrand/snapd/commit/95768199111.patch | \
sudo patch \
/var/lib/snapd/apparmor/profiles/snap.<your-snap>.<your-command>
sudo apparmor_parser -r \
/var/lib/snapd/apparmor/profiles/snap.<your-snap>.<your-command>
2) Pure Qt5 apps that use the native Qt upstream dbus-systray
implementation (such as Telegram), saves the icon in /tmp, so while we'd
propose something else upstream, you'd probably need a different
workaround. See [4] for more infos.
If there are some edge cases we don't cover, please get in touch with me
and we'll try to figure out a solution.
Happy snapcrafting of indicators!
[1] https://github.com/snapcore/snapcraft/commit/6c012194b
[2] https://github.com/3v1n0/appindicators-snapcraft-parts
[3] https://github.com/jdstrand/snapd/commit/95768199111796
[4] https://bugs.launchpad.net/snappy/+bug/1600136/comments/5
More information about the Snapcraft
mailing list