How to start Flatpak applications on boot up

Using a terminal workaround to start Flatpak applications in the background.

How to start Flatpak applications on boot up
Flatpak truck. Source: https://flatpak.org/

If you're using Linux then you've probably heard of Flatpak. For those that haven't, Flatpak is an application packaging technology that many enhanced security, backwards compatibility, and multi-platform features. It is quickly becoming the defacto application packaging system on Linux. It's main repository is Flathub, which contains over 1500 applications.

One issue I've encountered is auto-starting a Flatpak application in the background. Especially running Fedora without any Gnome extensions, there is no native GUI way to configure startup applications yet. Even using the Tweak Tool doesn't allow you to customize the startup command for the application. So if you, like me, want to run some Flatpak applications in the background on startup you have to create a file in the terminal. This method should work in other distributions as well.

First, if the following folder doesn't exist create it:

mkdir ~/.config/autostart

Last, create a .desktop file in that folder with the following contents

[Desktop Entry]
Type=Application
Name=Nextcloud
Exec=flatpak run com.nextcloud.desktopclient.nextcloud --background
Comment=Load Nextcloud in the brackground

The file has a simple format. The Type , Name, and Comment are just information in this case. This file will not actually create a shortcut on the desktop. The meat of the file is Exec. Here we specify the command to run our application in the brackground.

Another application I use this for is Geary my email client. It has the following .desktop entry

[Desktop Entry]
Type=Application
Name=Geary
Exec=flatpak run org.gnome.Geary --gapplication-service
Comment=Load Geary in the brackground

Notice the Exec command uses a different parameter for running in the background. This highlights the current limitation of the method, the application must support background startup.

Of course, this method also works for applications that are installed without Flatpak. They just have to be able to launch using the terminal.

That's it. Current workaround for starting Flatpak applications in the background on startup.