Snapcraft secret sauce: KDE neon extension

Igor Ljubuncic

on 21 November 2019

Simplicity is the magic ingredient in any product design. For members of the KDE community, snap development has become that much simpler, thanks to the recent introduction of the KDE neon extension.

Last year, we talked about the KDE build and content snaps, which can greatly speed the build of KDE application snaps and save disk space. The extension takes this effort one step farther, and allows for faster, smoother integration of snaps into the Linux desktop. While there are no shortcuts in life, you can rely on a passionate community of skilled techies to make the journey easier.

Let’s have a look at the magic behind the scenes.

KDE neon extension details

Currently, the KDE neon extension is available as a preview feature, so you will need the edge release of snapcraft to be able to test and use it. This also means it might not be suitable for immediate use in production environments where you expect complete stability and predictability. However, it’s a great way for early adopters and tinkerers to get a feel of the possibilities available in the latest snapcraft release.

snap refresh snapcraft --channel edge

Once you have the edge release installed, you can test the extension. The quickest way to explore the functionality is to download the Kcalc example as part of the Qt5 and KDE frameworks demonstration.

git clone https://github.com/galgalesh/kcalc.git

The snapcraft.yaml file contained in the cloned repo has some important declarations. In the app section, we can see the use of the extension, as well as the common-id field, used to link the AppStream metadata to this application.

apps:
  kcalc:
    common-id: org.kde.kcalc.desktop
    command: kcalc
    extensions:
  - kde-neon
    plugs:
      - home
      - opengl
      - network
      - network-bind
      - pulseaudio

The parts section includes the KDE build snaps, as well as several additional build and runtime dependencies that are not part of the common bundle. This means developers may need to tweak their YAML files for specific requirements, but in most cases, the bulk of dependencies will already be satisfied by the common components.

build-snaps:
      - kde-frameworks-5-core18-sdk
      - kde-frameworks-5-core18

That’s pretty much it! Run snapcraft to build the snap, and then test it.

In the background

Once you declare the KDE neon extension in your snapcraft.yaml and build the snap, the following will happen:

  • You will have the latest Qt5 and KDE Frameworks libraries available to your application at runtime. You won’t need to manually satisfy the runtime requirement, and this will also save a fair deal of disk space through the reuse of common components.
  • The extension initialises Qt5 and the desktop environment before the application starts, so functionality like fonts, cursor themes and a11y work correctly. This means you and the users of your snap should enjoy a smoother desktop integration and more consistent looks and behavior. Specifically, your snap will connect to the following content snaps at run time:
    • gtk-common-themes for common icon, cursor and sound themes. This snap will ensure the applications have a consistent look & feel in all desktop environments, as some of the elements may be missing in the system.
    • kde-frameworks-5-core18 for the Qt5 and KDE Frameworks runtime libraries.
    • The extension also configures each application entry with additional plugs: desktop, desktop-legacy, wayland, and x11.

Summary

The KDE neon extension is a handy “extension” to the snapcraft tool, offering a more streamlined build experience. It is also a result of feedback from the community, and we invested a lot of effort in making sure the developers have a pleasant, seamless work environment, and in turn, their users can also enjoy the software in a consistent, transparent manner.

If you’re an early adopter, you should grab the edge release of snapcraft now and test the extension. Finally, you may be asking, what about GNOME? Worry not, a similar extension is in the works, and we will blog about it in the near future.

If you have any comments, please join our forum for a discussion.

Photo by Artem Maltsev on Unsplash.

Ubuntu desktop

Learn how the Ubuntu desktop operating system powers millions of PCs and laptops around the world.

Newsletter signup

Select topics you’re
interested in

In submitting this form, I confirm that I have read and agree to Canonical’s Privacy Notice and Privacy Policy.

Related posts

How to build ROS 2 Eloquent Snaps

The end of 2019 brings about the latest ROS 2 release – Eloquent Elusor. Despite an ever growing set of features and some changes throughout the ecosystem,...

Building a Rust snap by Example

There’s plenty of official documentation which details how to create snaps. We live in the copy/paste generation though. So lets walk through a real-world...

ObjectBox, database for IoT devices, adopts snaps for simplicity and ease of installation

When designers put their heart and soul into making super-fast, easy-to-use software to help take Internet of Things (IoT) apps to the next level,...