Open JakobDev opened 2 years ago
CC @mwleeds
xdg-desktop-portal is determining the app ID for unsandboxed processes by looking at the systemd unit name and interpreting it according to this standard. As discussed here, launching an app from the command line in such a way that it complies with the aforementioned standard is possible but not intuitive. There's another relevant comment here:
Yeah, I don't think we need to cover this use-case for now. Properly spawning applications require some help from the compositor and the session manager these days, and that's primarily what we're trying to improve here.
Also relevant are this and the following comments on the PR that implemented the dynamic launcher portal: https://github.com/flatpak/xdg-desktop-portal/pull/696#issuecomment-1057570063
As you can see, it sets the Application name to com.example.test: app.setDesktopFileName("com.example.test") app.setApplicationName("com.example.test") It calls the Install method with com.example.test.launcher.desktop as desktop_file_id
But then the portal method is called before that app
object has exec()
called on it, so you are effectively calling the portal from your script not from the app, unless I'm misunderstanding something? If this code is just a minimal reproducer, what is the actual use case you have that's running into this problem?
So I'm a little uncertain where this leaves us for Epiphany. It seems we need to either (a) change Ephy somehow to not use the dynamic launcher portal unless we are sandboxed, or (b) switch back to the GNOME 42 version of the code?
So I'm a little uncertain where this leaves us for Epiphany. It seems we need to either (a) change Ephy somehow to not use the dynamic launcher portal unless we are sandboxed, or (b) switch back to the GNOME 42 version of the code?
I don't understand how this issue affects Epiphany. When Epiphany is run from the desktop launcher (gnome-shell) it should be compliant with the systemd standard, and the portal should have no problem determining its app ID correctly.
But you cannot assume that Epiphany is run from gnome-shell since it can be run from arbitrary desktops. What about Pantheon and Phosh, which are the desktops that are actually used by the distros that are shipping Epiphany as default browser?
I didn't mean to imply it had to be gnome-shell. Any desktop environment should be able to comply with that systemd standard when it launches apps, and as far as I know they all do. KDE Plasma definitely does.
To be clear the problem here is https://gitlab.gnome.org/GNOME/epiphany/-/issues/1859 and it results in Epiphany web apps crashing.
I really think we should just bite the bullet and implement a setAppId that in xdg-desktop-portal. Yeah, it can be abused if it's not sandboxed but so can everything else.
I'm not opposed to making a SetAppID
method available to unsandboxed processes, as long as we do some research on the implications of that first. But it seems to me the root cause of https://gitlab.gnome.org/GNOME/epiphany/-/issues/1859 is not fully understood and it's not as simple as being "this issue".
I think the best way would be to let unsandboxed App use every ID they like
I think the best way would be to let unsandboxed App use every ID they like
Very strong disagree here. This should not ever be allowed by xdg-desktop-portal.
Yeah, the information of the SetAppID
method should only be used if automatic detection failed.
I have the following code:
As you can see, it sets the Application name to com.example.test:
It calls the Install method with com.example.test.launcher.desktop as desktop_file_id. If I run it outside the Sandbox, it fails with this error:
As you may see, I run the code through Konsole. If I set the desktop_file_id to org.kde.konsolelauncher.desktop it works. This is really bad. The code should work inside and outside the Sandbox. Inside the Sandbox, the name if always clear: I's the name of the Flatpak. But outside the Sandbox the name depends on how you run the program which is something I don't have control over as a developer.
There are 2 ways to solve this Issue: