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

Implementation of freedesktop portals (for flatpak) #7695

Open
goffi-contrib opened this issue Nov 18, 2021 · 6 comments
Open

Implementation of freedesktop portals (for flatpak) #7695

goffi-contrib opened this issue Nov 18, 2021 · 6 comments

Comments

@goffi-contrib
Copy link

goffi-contrib commented Nov 18, 2021

Hello,

to access resources in an isolated environment, the concept of "portals" has been developed for flatpak (see https://docs.flatpak.org/en/latest/desktop-integration.html and https://flatpak.github.io/xdg-desktop-portal/portal-docs.html), it's an API which notably uses native dialogs when some resource (like a file) needs to be accessed.

Supporting portals is necessary to have a good integration in Flatpak (otherwise an application would have to request too much permissions).

Qt and GTK already support portals, but as far as I know there is nothing going in this direction yet for Kivy.

Thus I'm filling this feature request to evaluate if it's planned or even doable to implement this API in Kivy.

Thanks

@tshirtman
Copy link
Member

tshirtman commented Nov 19, 2021

I don't think we were aware of that development, i have yet to read to the docs in depth, but i'm not sure which kind of integration would be needed in kivy, looking at the list of examples

Determining network status
Opening a file with a file chooser
Opening URIs
Preventing the device from suspend/sleep/powering off
Printing
Sending email
Showing notifications
Taking screenshots and screencasts

None of these features are directly used by kivy, though some are accessible through plyer. The table of contents of the docs seems to be similar, all features that are not directly exposed by kivy.

But if it's for plyer, it might be similar to the PR i did sometime ago (and let rot…) kivy/plyer#629 to automatically ask for permissions for android features at runtime, if similar logic is required for linux under flatpack, we could certainly add it (provided we can detect the application runs through flatpack).

@goffi-contrib
Copy link
Author

I was indeed hesitating to open this on plyer tracker, but I've put it here at the end because kivy has as filechooser widget, and stuff in API to access camera. Could this issue be moved to plyer if it's more relevant there?

@tshirtman
Copy link
Member

Hm, you are right about the filechooser and camera indeed, but looking at the docs for filechooser (https://flatpak.github.io/xdg-desktop-portal/portal-docs.html#gdbus-org.freedesktop.portal.FileChooser), it looks like it wouldn't allow the kivy filechooser to work, but rather replace it with something similar to plyer's?

The FileChooser portal allows sandboxed applications to ask the user for access to files outside the sandbox. The portal backend will present the user with a file chooser dialog.

The selected files will be made accessible to the application via the document portal, and the returned URI will point into the document portal fuse filesystem in /run/user/$UID/doc/.

@goffi-contrib
Copy link
Author

goffi-contrib commented Nov 19, 2021

yes it uses the native file chooser, thus the widget could not really be used. If you don't give access to your whole $HOME in flatpak you need to use this API to let the user choose a file that you can then access. The Kivy widget would not have access to anything outside the container (i.e. not what the user wants).

@tshirtman
Copy link
Member

Ok, then i think it doesn't make much sense to add it for filechooser in kivy, it might make sense to add it for the camera provider/widget, i don't know how common that use case is, but it could be worth the trouble, at least i think i would accept a PR for it if it doesn't come at an extraordinary cost in complexity. For plyer on the other hand, it seems like it would be pretty important.

@goffi-contrib
Copy link
Author

goffi-contrib commented Nov 19, 2021

yes I think it is very important for plyer, and file API should be among the highest priority. Unfortunately I'm far too busy myself to contribute a PR right now, and wont be before months.

edit: Implementation in plyer will have the benefit to be useful even for people not using Kivy.

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

No branches or pull requests

2 participants