<div dir="ltr"><div dir="ltr"><div>You can use the Background portal to create an autostart file for your application at runtime: <a href="https://flatpak.github.io/xdg-desktop-portal/#gdbus-org.freedesktop.portal.Background" target="_blank">https://flatpak.github.io/xdg-desktop-portal/#gdbus-org.freedesktop.portal.Background</a>. This isn't as robust as, say, a systemd service, but it works nicely for desktop applications.</div><div><br></div><div>For example, here's where GNOME Break Timer sets up autostart with the background portal: <a href="https://gitlab.gnome.org/GNOME/gnome-break-timer/-/blob/master/src/settings/BreakManager.vala" target="_blank">https://gitlab.gnome.org/GNOME/gnome-break-timer/-/blob/master/src/settings/BreakManager.vala</a>. Note there are some wrinkles because we need to ask permission from the user and we can't be sure they will allow it.</div><div><br></div><div>Pika Backup is another app which uses the Background portal: <a href="https://gitlab.gnome.org/World/pika-backup" target="_blank">https://gitlab.gnome.org/World/pika-backup</a> / <a href="https://gitlab.gnome.org/World/pika-backup/-/blob/main/src/ui/utils.rs" target="_blank">https://gitlab.gnome.org/World/pika-backup/-/blob/main/src/ui/utils.rs</a>.</div><div><br></div><div>Alternatively, if this is an optional feature and you really want a systemd service, you can always have that as an extra step. So, structure your flatpak in such a way that the background service you want is a command you can run inside that container, then provide an example systemd service file which a user could install. But that way lies dragons, so I hope the background portal will do the trick.<br></div><div><br></div><div>Hope that helps!</div><div><br></div><div>Dylan</div></div></div>