Always "Allow Opening File"

Hello,

I use xdg-open to open a folder form a snap package. Then it will prompt a dialog to ask “Allow Opening File” from the user. Is it possible to make user need to accept once only? So that it won’t prompt again and always open.

Thanks.

4 Likes

I am also interested in this question.

This probably should be posted in the #snapd topic and perhaps someone involved with the portals support such as @jamesh could comment on if it’s possible to remember the setting

The current snap userd backend used by the sandbox xdg-open is using zenity to present the graphical prompt. So there are limits to what we can do there.

It is true that xdg-desktop-portal duplicates this functionality, so my personal preference is to focus on that as the eventual replacement.

I don’t think we are yet at the point where we can delete the code in userd, but we could have the sandbox-side xdg-open code try the portal API first and fall back if the bus reports that the portal service is not available.

For what it is worth, we should have this implemented soon:

If you have xdg-desktop-portal installed on the host system, then the sandbox xdg-open script will use it in preference to snap userd. This will replace the Zenity dialog with something that looks a bit nicer, and give the option to remember the decision.

1 Like