Plasma/Mobile/AppDevelopment
Under Construction |
---|
This is a new page, currently under construction! |
The setup described in this page is still a proposal. It works, but is not yet adopted as "the official way".
Plasma Mobile application development
This page will guide your through creating a properly packaged Plasma Mobile app. We will use the KDE flatpak SDK to develop and package the app, so all that is required is a working flatpak and flatpak-builder installation.
On Debian and derivates, you can use sudo apt install flatpak flatpak-builder
.
Using the Kirigami application template
First, clone the app template: git clone https://gitlab.com/jbbgameich/plasma-mobile-app-template.git
This repository can be used as a template to develop Plasma Mobile applications. It already includes templates for the qml ui, a c++ part, app metadata and flatpak packaging.
Local building and testing using the SDK
flatpak install flathub org.kde.Sdk//5.11 # Only needs to be done once flatpak-builder flatpak-build-desktop --force-clean --ccache *.json flatpak-builder --run flatpak-build-desktop *.json hellokirigami
Creating a flatpak for the phone
This assumes your system is already set up as described here. Make sure your system also supports qemu user emulation. If not, you can find help for example here
flatpak install flathub org.kde.Sdk/arm/5.11 # Only needs to be done once flatpak-builder flatpak-build-phone --repo=arm-phone --arch=arm --force-clean --ccache *.json flatpak build-bundle arm-phone app.flatpak org.kde.hellokirigami
Now your app is exported into app.flatpak. You can copy the file to the phone using scp:
scp app.flatpak [email protected]:/home/phablet/app.flatpak
ssh [email protected] flatpak install app.flatpak
Your new application should now appear on the homescreen.
Using the template to develop your application
Edit the files to fit your naming and needs. In each command, replace “io.you.newapp” and “newapp” with the id and name you want to use
find . -name "CMakeLists.txt" -or -name "*.desktop" -or -name "*.xml" -or -name "*.json" -exec sed -i 's/org.kde.hellokirigami/io.you.newapp/g;s/hellokirigami/newapp/g' {} \; for file in $(find . -name "org.kde.hellokirigami*"); do mv $file $(echo $file | sed "s/org.kde.hellokirigami/io.you.newapp/g"); done
Submitting your new application to the repository
Once your application is working and is usable, you can submit a patch to include it into the KDE flatpak repository.
After setting up git with the recommended KDE settings, you can create a new file io.you.newapp.remoteapp in the flatpak-kde-applications repository.
git clone kde:flatpak-kde-applications && cd flatpak-kde-applications
Paste the following content into the file:
ID=io.you.newapp JSON=io.you.newapp.json GITURL=https://gitlab.com/you/newapp.git
You can now submit the patch on Phabricator. Once accepted, your app will be automatically built, published and made available in Discover (if the KDE flatpak repository is enabled on the device).