Snapcraft secret sauce: KDE neon extension
Igor Ljubuncic
on 21 November 2019
Tags: edge , extension , kde , neon , snapcraft.io
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
Related posts
The long ARM of KDE
With over 100 applications available in the Snap Store, KDE is by far the biggest publisher of snaps around. What unifies this impressive portfolio is the...
Canonical provides the ideal platform for Microsoft Azure IoT Operations
London, 19 November 2024. Canonical has collaborated with Microsoft as an early adopter partner and tested Microsoft Azure IoT Operations on Ubuntu Core and...
How to deploy AI workloads at the edge using open source solutions
Running AI workloads at the edge with Canonical and Lenovo AI is driving a new wave of opportunities in all kinds of edge settings—from predictive maintenance...