KDE apps at the snap of your fingers

by Igor Ljubuncic on 15 December 2018

Are you a Plasma fan? And you want to develop KDE applications? This has just become easier and more fun than ever before.

In early November, we hosted a Snapcraft Summit in our London offices, a forward-thinking software workshop attended by major software vendors and Snapcraft engineers working at every level of the stack. Together, we sat down and helped bootstrap snaps of some really amazing products.

One of the participants was Harald Sitter, a longtime KDE developer and enthusiast. With more than one notch of experience on his snap belt, Harald joined us to think of innovative ways of making the publication of Qt and KDE applications easier and faster both for experienced developers as well as those just getting involved in this domain. Together, we came up with some really cool concepts and implementations for the KDE development stack, based on snaps:

  • Build-snap – this package is an essential snap that includes all the different build dependencies needed for KDE development – specifically the KDE Frameworks 5. If you want to create a new KDE application, this snap comes with the necessary libraries and tools for development. You can use the build-snap on any system, without having to worry whether your system satisfies the dependencies, or having to run virtualization, containers or other complex setups. You can also develop with the latest, bleeding-edge Qt, Qt Quick, Kirigami and Plasma toolkits without using any custom repositories. This approach also cuts down on boilerplate definitions that you normally have to put into the snapcraft.yaml file.
parts:

    kblocks:

        source: https://anongit.kde.org/kblocks.git

        plugin: cmake

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

Speaking to Harald, he elaborated on his experience and his take on the build snap:

With the new build snap technology, KDE application snapping is much easier than before as less obscure code needs to be added to make a snap actually use the correct development files to build software against the content snap. Previously, we had to resort to manually creating tarballs with all necessary assets and then instruct snapcraft to unpack them correctly. Now, snapcraft takes care of setting this up, and the build snaps, by virtue of being snaps, can make use of all the goodness of the Snap Store (e.g. clear revisions, easy rollback). The build snaps, together with the forthcoming extension, will make snapping KDE software super easy by moving all cruft behind the scenes, and a simple snapcraft.yaml will know how to properly build KDE software.

  • Content snap – this package is an essential snap that includes all the runtime libraries for KDE applications. The use of the content snap will make your KDE experience consistent, both in looks and functionality. It allows multiple applications to share the same runtime libraries, reducing the effective disk footprint by up to 99%!The full stack for Qt (3D acceleration middleware, translations, etc.), on top of the core snap, weighs somewhere between 100 and 200 MB, while most applications (including translations, documentation, artwork) are below 10 MB. A good example is Kcalc. If one were to put all the absolutely necessary requirements for Kcalc into one snap it’d be about 90 or 100 MB in size. With the content snap, Kcalc weighs only 500 KB, and the rest is shared through the content snap.Again, much like the build snap, it allows for modular usage, without having to maintain complex work setups.
apps:

    kblocks:

        command: kf5-launch kblocks

        plugs:

        - kde-frameworks-5-plug

        - home

        - x11

        - opengl

        - desktop

plugs:

    kde-frameworks-5-plug:

        content: kde-frameworks-5-all

        interface: content

        default-provider: kde-frameworks-5

        target: kf5
  • CMake improvements – the snapcraft CMake plugin is more generic. We have removed the reliance on make as the underlying build system, which enables the use of other build systems such as ninja. Several KDE snaps were refactored and successfully used build-snaps, including several games (KAtomic, Granatier and Bovo), utilities (for instance, the aforementioned Kcalc) and education programs (like KmPlot and KGeography). A number of other KDE application snaps were fixed or improved, and published in the store.

For instance, instead of:

parts:

    kblocks:

        source: https://anongit.kde.org/kblocks.git

        plugin: cmake

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

        configflags:

            - -DCMAKE_FIND_ROOT_PATH=/snap/kde-frameworks-5-core18-sdk/current

One can write:

parts:

    kblocks:

        source: https://anongit.kde.org/kblocks.git

        plugin: cmake

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

We also worked with Harald to reason through what would be contained in a snapcraft extension for KDE. This is currently work in progress, but should bring about some really useful features for developers.

KDevelop & Kirigami

Looking to the future, with cmake changes and the KDE extension in place, KDevelop will come with an integrated snap functionality. Developers who want to develop new applications using the KDE Frameworks will not need to worry about manually collecting and satisfying dependencies and putting everything together anymore.

Speaking of the future, while you’re waiting, you might want to check out the demo snap that showcases the new converged Kirigami framework, and allows both developers and users a taste of the new KDE using the new responsive, elegant, and open cross-platform QML-based toolkit.

There’s more! Plasma as a snap!

If you find the build and content snaps interesting, wait until you try the ENTIRE Plasma desktop. As a snap. The desktop comes as a standalone application, which you can run without making any changes to your underlying system. You also do not need to have the latest and greatest Linux distribution version to run the snap. If the system supports snaps, it will run the Plasma desktop.

Please note that this is still a tech preview and should not be considered for production. Because you’re installing in “devmode” it will have unfettered access to your system, much like a classically-packaged application. But you can install and test it easily:

snap install --edge --devmode plasma-desktop

You can test the desktop environment even on older systems. You can also test multiple versions in parallel, and have stable and bleeding-edge versions of the desktop living happily side by side without any library conflicts or clashes. The snap also integrates nicely into the SDDM login manager, so you have a seamless experience.

These are some of the many new features coming into the KDE world. Over the coming weeks, as we roll up improvements, you will be able to use the build and content snaps, which should make the development easier and faster. End users can already test some of the hot new stuff through the edge and beta channels in the Snap Store.

Stay tuned for updates.

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 fact that all of these snaps are made for the x86 platform. Not anymore. Now, don’t panic! The x86 snaps are not going anywhere. But ARM-supported KDE snaps are […]

Linux Application Summit 2022 – And there we were all in one place …

In the last two days of April, the small, picturesque town of Rovereto in northern Italy was the location of this year’s Linux Application Summit (LAS). After a virtual-only experience during the pandemic, the LAS returned with a physical presence, and so did we. Canonical has long recognized the value and importance of LAS as […]

KDE snaps performance revving up

Speed, or rather, responsiveness is an essential part of the software usage experience. This applies to every technology and domain, snaps included. Indeed, when it comes to snaps, the equation is a bit more complicated and slightly less straightforward because snaps are packaged as compressed, standalone applications and wrapped in a num […]