Flatpak is a solution for creating sandboxed software builds for GNU/Linux systems. You can find more information here.
KDE Software approach to Flatpak is still not ready. Nevertheless, it's being shaped up. If you're interested in helping, please send an e-mail to firstname.lastname@example.org.
The idea behind flatpak is that your applications will depend on a runtime. KDE provides a runtime with Qt and all KDE Frameworks 5 (except for the 4th tier) to make sure it's easily adaptable for any KDE Application and possibly most Qt-based applications as well.
This runtime can be added by following these instructions:
flatpak remote-add --user kderuntime --from https://distribute.kde.org/kderuntime.flatpakrepo flatpak install --user kderuntime org.kde.Platform//master flatpak install --user kderuntime org.kde.Sdk//master
Test an application
flatpak remote-add --user kdeapps --from https://distribute.kde.org/kdeapps.flatpakrepo flatpak install --user kdeapps org.kde.okular
Compile your application
Now you get to compile your favorite application. If you want to see how it's done, you can see some of the ones that have already been built. You can find it here.
To compile an applications, you should create a json file similar to the ones in the previous link. Then you'd just need to trigger the build and get it into a repository. For testing, I recommend just creating a local one (to publish an rsync will be required).
mkdir app repo flatpak-builder --ccache --repo=repo --subject="Build of AWESOMEAPP `date`" app org.kde.AWESOMEAPP.json
This will do everything required and create a repository in ./repo. To test the application we add the repository (called remotes), we install the application and then we run it:
flatpak remote-add awesomeapp repo --no-gpg-verify flatpak install awesomeapp org.kde.AWESOMEAPP flatpak run org.kde.AWESOMEAPP
Now you will see that some things don't work and you'll have the privilege to start fixing things!
install) accept a
--useroption to install things at the user level, without being prompted for the sudo password every time.
In the following repositories you'll find the code in charge of packaging the runtime (Qt 5 and KF5) and then several (but not all, yet) KDE Applications.
- Runtime: https://cgit.kde.org/flatpak-kde-runtime.git/
- Applications: https://cgit.kde.org/flatpak-kde-applications.git/
Portals are high-level session bus APIs that provide selective access to resources to sandboxed applications. The implicit expectation of portals is that the user will always be involved in granting or rejecting a portal request, thus most portal APIs will lead to user interaction in the form of dialogs.
Since such dialogs must fit into the user experience of the desktop shell, the portal APIs are implemented by a generic frontend called xdg-desktop-portal which calls out to desktop-specific implementations that provide the actual UI. The bus name through which the portal APIs are available is org.freedesktop.portal.Desktop, with the object path /org/freedesktop/portal/desktop implementing the various portal interfaces.
KDE implementation of portals
KDE backend for flatpak portals is called xdg-desktop-portal-kde and is now part of Plasma releases (starting with Plasma 5.10). Currently it supports most of the portals. To make Qt applications use or call portals frontend in sandbox we developed a Qt platform plugin which is now part of our runtimes. All you need to make your app use the plugin is to pass -platform flatpak parameter, or set QT_QPA_PLATFORM variable to flatpak. If you want to test KDE flatpak portals, you can use this simple test app.
Styles and integration with other desktops
We are aware that not everyone is using KDE/Qt applications in Plasma desktop. For this flatpak comes with extensions, where you specify a directory (with themes, icons) where third-party is allowed to install additional stuff as an addition to what we have in our runtimes. At this moment we have added support for Gnome in form of adwaita icons and adwaita-qt style. All you need to is install following extensions using commands below:
flatpak install kderuntime org.freedesktop.Platform.Icontheme.Adwaita flatpak install kderuntime org.kde.KStyle.Adwaita flatpak install kderuntime org.kde.PlatformTheme.QGnomePlatform