How to Develop Linux Applications (Part 2)

Tina Huynh
4 min readMay 7, 2022

Table of Contents

  1. AppCenter Dashboard
  2. AppImage
  3. Flatpak
  4. Snapcraft
  5. Helpful Links

AppCenter Dashboard

  • New apps get featured with a large, branded banner. Plus, trending and recently-updated apps are featured on the front page.
  • Define your app’s keywords, categories, and subcategories to help people find it.
  • With built-in social media sharing and app URLs, users can easily share your app right from AppCenter.

You need to make sure you prefix your Application.vala file in your src folder and that it matches your license of your code and assigns copyright to you.

/*
* SPDX-License-Identifier: GPL-3.0-or-later
* SPDX-FileCopyrightText: 2021 Your Name <you@email.com>
*/

Your MetaInfo file will contain all the information needed to list your app in AppCenter and will look something like:

<?xml version="1.0" encoding="UTF-8"?>
<component type="desktop-application">
<id>com.github.myteam.myapp</id>
<name>My App</name>
<summary>Proves that we can use Vala and Gtk</summary>
<metadata_license>CC-BY-4.0</metadata_license>
<project_license>GPL-3.0-or-later</project_license>
<description>
<p>
A quick summary of your app's main selling points and features. Just a couple sentences per paragraph is best
</p>
</description>
<launchable type="desktop-id">com.github.myteam.myapp.desktop</launchable>
</component>

Your desktop entry file will contain all the information needed to display your app in the applications menu as well as the dock and should look something like this:

[Desktop Entry]
Version=1.0
Type=Application
Name=My App
Comment=Proves that we can use Vala and Gtk
Categories=Development;Education;
Icon=com.github.myteam.myapp
Exec=com.github.myteam.myapp
Terminal=false

Check Our First App here for the rest of the code and full explanation and details.

Back to TOC

AppImage

Distribute your desktop Linux application in the AppImage format and win users running all standard Linux distributions.

appimage-builder is a novel tool for creating AppImages. It uses the system package manager to resolve the application dependencies and creates a complete bundle. It can be used to pack almost any kind of applications including those made using: C/C++, Python, and Java.

There are tutorials as well as troubleshooting documentation for more information.

How to Install appimage-builder

Option 1: AppImage for amd64 systems

wget -O appimage-builder-x86_64.AppImage https://github.com/AppImageCrafters/appimage-builder/releases/download/v1.0.0-beta.1/appimage-builder-1.0.0-677acbd-x86_64.AppImage
chmod +x appimage-builder-x86_64.AppImage
# install (optional)
sudo mv appimage-builder-x86_64.AppImage /usr/local/bin/appimage-builder

Option 2: Docker Image

NOTE: Testing AppImages is not supported on this format. Always use –skip-test.

docker pull appimagecrafters/appimage-builder:latest

Option 3: Manual Installation

The project is built using Python 3 and uses various command-line applications to fulfill its goal. Depending on the host system and the recipe the packages providing such applications may vary.

Step 1: Installing dependencies
Debian/Ubuntu

sudo apt install -y python3-pip python3-setuptools patchelf desktop-file-utils libgdk-pixbuf2.0-dev fakeroot strace fuse# Install appimagetool AppImage
sudo wget https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage -O /usr/local/bin/appimagetool
sudo chmod +x /usr/local/bin/appimagetool

Arch Linux

sudo pacman -Sy python-pip python-setuptools binutils patchelf desktop-file-utils gdk-pixbuf2 wget fakeroot strace# Install appimagetool AppImage
sudo wget https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage -O /usr/local/bin/appimagetool
sudo chmod +x /usr/local/bin/appimagetool

Step 2: Installing appimage-builder
Option 1: Installing the latest tagged release:

sudo pip3 install appimage-builder

Option 2: Installing the development version:

sudo pip3 install git+https://github.com/AppImageCrafters/appimage-builder.git

Step 3: Install appimagetool

There is an issue in the AppImage runtime format that prevents it proper execution inside docker containers. Therefore we must use the following workaround to make appimagetool work properly.

# Install appimagetool AppImage
sudo wget https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage -O /opt/appimagetool
# workaround AppImage issues with Docker
cd /opt/; sudo chmod +x appimagetool; sed -i 's|AI\x02|\x00\x00\x00|' appimagetool; sudo ./appimagetool --appimage-extract
sudo mv /opt/squashfs-root /opt/appimagetool.AppDir
sudo ln -s /opt/appimagetool.AppDir/AppRun /usr/local/bin/appimagetool

Back to TOC

Flatpak

Flatpak is a framework for distributing desktop applications on Linux and runs as an independent open source project.

  • Build for every distro
  • Develop apps compatible with new versions of Linux distributions
  • Make your apps available with Flathub
  • An independent community develops Flatpak

Check their developer guide or see the number of distros Flatpak can use.

Read the Flatpak documentation to get everything you need to know to build and distribute applications using Flatpak.

Building your first Flatpak is a great place to start! They even have tips and tricks

Snapcraft

Build and publish your snaps to the Snap store

At the heart of the snapcraft build process is a file called snapcraft.yaml. This file describes a snap’s build dependencies and run-time requirements, it integrates remote repositories and extensions, and runs custom scripts and hooks for better integration with CI systems.

snapcraft.yaml is organized into three principal sections: top-level metadata, apps and services, and parts.

  1. top-level metadata contains values typically used by the store
- architectures
- assumes
- base
- compression
- contact
- description
- hooks
- issues
- icon
- layout
- license
- summary
- title
- type
- version
- plugs
  1. app and services describe how the app and services are exposed to the host system
- adapter
- autostart
- command
- command-chain
- desktop
- environment
- install-mode
- listen-stream
- restart-condition
- refresh-mode
  1. parts describe how to import and build each required part of the snap
- build-attributes
- build-snaps
- organize
- parse-info
- source
- stage

For more information, check documentation guidelines, installing snapd, releasing your app, managing snaps, and troubleshooting.

Back to TOC

Helpful Links

Will you become a Linux app developer?

Happy coding!

--

--