DBus services in Flatpak applications

An application of mine requires a DBus service to communicate with a GNOME Shell extension. Can I package such an application with Flatpak?

I tried installing the service in the Flatpak file system. This triggered the following error:

Running: install -Dm644 -t /usr/share/dbus-1/services/ meta/io.github.pieterdd.StretchBreak.Core.service
install: cannot create regular file ‘/usr/share/dbus-1/services/io.github.pieterdd.StretchBreak.Core.service’: Read-only file system

The prefix /usr is reserved for the runtime. As an application you cant put files there.

The prefix for applications is /app. So you need to place the DBus file under /app/share/dbus-1/services.

Also, if you want your app to talk to talk to a bus outside of the sandbox, you need to add the --talk-name or --own-name permission for the bus in question.

1 Like

The service file got installed, but I don’t have the impression that it’s working completely.

The main reason I want the service file is to ensure my application can autostart when a DBus call to it is done by an accompanying GNOME Shell extension. The extension runs outside the Flatpak container. The service doesn’t seem to autostart.

Am I missing something here?

Nevermind, just needed to adapt the Exec attribute in the service definition to reflect the new path!