Updating Featured apps without the need of an upgrade- 3 mins
This is a quick note to demonstrate how a distribution can update it’s list of “Featured” apps without pushing a new OS upgrade to its users. It’s quite beneficial to have such a functionality in gnome-software so that the list of “Featured” applications can be updated frequently, making overall user experience a further more dynamic. Let’s go shopping!
I will be focusing this post on updating the featured apps’ banner carousel that appears on the landing page of gnome-software. It displays various apps that are meant to be featured. The metadata for which apps are being featured lives in gnome-software.git tree; that means you can only update this list on gnome-software’s new release vis-a-vis a new OS release in cases of immutable OSes.
There is also a functionality in gnome-software that lets you do this via external-appstream plugin. The external-appstream plugin helps to specify some extra-metadata for apps that is not included in the upstream appdata. Hence, distributions can decide their own subset of metadata they desire, which will append to existing appdata for an app in gnome-software. This can be “Feature this app” or even something like adding new set of
<categories> to an app.
You will need:
- An appstream file specifying desired metadata for apps.
- A remote URL location which hosts this external-appstream file
Overall steps to achieve this:
- Enable external-appstream plugin in your build system (it’s disabled by default)
external-appstream-urlsorg.gnome.software’s gsetting to the URL where you file is hosted
Once the setup is done, you should see gnome-software will fetch the external-appstream file for you and write to
/var/cache/app-info/xmls/ directory(location is defined by the external-appstream plugin). The next run of gnome-software will also include all the additional metadata coming from the external-appstream (it might require to drop all the caches, typically at
Let’s delete the
/usr/share/app-info/xmls/org.gnome.Software.Featured.xml file which is the list of featured apps coming from gnome-software’s source tree. This is just to ensure that GNOME Software doesn’t pick up any featured apps from there for this tutorial. GNOME Software will fallback to one app-banner carousel which is embedded into it’s source code. This is probably done to avoid a hollow banner window on the landing page at all costs. In this case, the fallback featured app is GNOME Builder.
Prepare an external appstream file. For featuring a app in banner carousel, the app’s metadata should have
GnomeSoftware::FeatureTile-css. This metadata is what we will provide to the app via external-appstream make it as a “Featured” entry. For demo purposes, I selected the Polari app and I will use a GNOME Logo SVG for it’s background.
<?xml version="1.0" encoding="UTF-8"?> <components version="0.8"> <component type="desktop" merge="append"> <id>org.gnome.Polari.desktop</id> <metadata> <value key="GnomeSoftware::FeatureTile-css">border-color: #4e9a06; text-shadow: 0 2px #418e64; color: #a8c74f; outline-offset: 0; outline-color: alpha(#a8c74f, 0.75); outline-style: dashed; outline-offset: 2px; background: url('https://people.gnome.org/~engagement/logos/GnomeLogoHorizontal.svg', #43a570; </value> </metadata> </component> </components>
(For brevity, formatting aspects of banner design are out of scope for this post. GNOME Software banners are be updated live using Banner Viewer.)
This external-appstream is hosted here.
external-appstream-urls gsetting to this url on my system:
$ gsettings set org.gnome.software external-appstream-urls "['https://gist.githubusercontent.com/uajain/4d9b7ab373591b97357716c2425a07e5/raw/fa14e7e227aa165bee15be7c1940520a8f1b62e5/org.gnome.software.featured_demo.xml']"
Restarting GNOME Software and Voila!
External appstream is not limited to featuring apps. It can do much more like specifying categories and category-featured apps. EndlessOS uses this feature heavily in order to keep the list of featured apps fresh and crisp. Take a look at EndlessOS’s external-appstream file.