Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow service activation by D-Bus #1902

Closed
goffi-contrib opened this issue Jul 14, 2018 · 6 comments
Closed

Allow service activation by D-Bus #1902

goffi-contrib opened this issue Jul 14, 2018 · 6 comments
Labels

Comments

@goffi-contrib
Copy link

Hello,

I have created flatpaks for Salut à Toi (https://salut-a-toi.org), which is working on daemon/frontends architecture. The daemon is in its own flatpak, and each frontend has its own flatpak too.

To use a frontend, the daemon must be launched, and it must not be relaunched when an other frontend needs it (the running instance must be used).
On standard desktop this can be achieved either by a SystemD or D-Bus .service file.
For instance, the following file can be installed in /usr/share/dbus-1/services/org.salutatoi.SAT.service: https://repos.goffi.org/sat/raw-file/tip/misc/org.salutatoi.SAT.service, to have the desired effect.

This is, as far as I know, not possible currently with Flatpak, resulting in a bad user experience. Indeed, if the user tries to launch a frontend there will be an error message, and he/she has to launch the backend manually.

Would it be possible to add a way to start an other flatpak on D-Bus request? This could be achieved by a .service similar to the one I've linked above placed in a well-know location in the container, and then adapted by Flatpak and put in /usr/share/dbus-1/services/[APP ID].service, a new permission could be necessary to allow that.

Thanks.

@TingPing
Copy link
Member

It works fine as long as your service file matches your app-id. Could you post your complete manifest perhaps?

@goffi-contrib
Copy link
Author

Hi @TingPing , thanks for your feedback.
All the manifests are at https://repos.goffi.org/sat_docs/file/tip/flatpak . The backend is org.salutatoi.SAT.json.
I'm not sure where I should put this .service file then, as on normal distribution it should be on /usr/share/dbus-1/services/org.salutatoi.SAT.service (which I can't access, and it would be in the container anyway). Also should I use Exec=sat, org something like Exec=flatpak run org.salutatoi.SAT?

Thanks!

@TingPing
Copy link
Member

/app/share/dbus-1/services/org.salutatoi.SAT.service just like all other data. The Exec line doesn't need to be changed.

@goffi-contrib
Copy link
Author

@TingPing right this is working, thanks a lot! I've made tries before, but I have probably missed something in the path.

One last thing: is there a way to install backend when a frontend is installed? For instance if I want to install desktop frontend, I can install org.salutatoi.Cagou but it would need org.salutatoi.SAT in order to work, is there any way to install it automatically if it's missing, or should I display a message asking the user to install it ?

@TingPing
Copy link
Member

I can install org.salutatoi.Cagou but it would need org.salutatoi.SAT in order to work, is there any way to install it automatically if it's missing, or should I display a message asking the user to install it ?

There are no dependencies. you can yell at the user but that is exactly what flatpaks shouldn't be doing. Just bundle what you need.

@goffi-contrib
Copy link
Author

@TingPing OK. Thanks !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants