-
-
Notifications
You must be signed in to change notification settings - Fork 183
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
Add portals configuration file for desktop environments #955
Conversation
Open questions:
The CI failure on 16.04 is unrelated, and seems to be an infrastructure issue. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't seem to work as I expect
[preferred]
default=kde
org.freedesktop.impl.portal.FileChooser=gtk
I think a warning would be appropriate. |
I sadly don't find It might be nice to start changing that by including a manpage for the portals.conf file format. |
Switched to a warning.
Done. I've added an optional dependency on |
0dd5c55
to
8205cb9
Compare
Give some meaningful names to reused variables, and group portals that depend on other portals together.
Use the same code GLib uses to ensure that the desktop names are retrieved once, and are valid according to the Desktop Entry specification.
Instead of having each portal define the preferred desktop to use its interfaces in, we should have the desktops define the kind of portals to use, depending on the interface. This requires adding a new configuration file, shipped by the desktop upstream (or by a downstream distributor) that defines the preferred portal implementation(s) to use, with the ability to define the implementation of each interface. The configuration file is in the format "$DESKTOP-portals.conf", in order to match the XDG_CURRENT_DESKTOP environment variable. For environments that are not classified as "desktops", it's still possible to define a "portals.conf" configuration file under XDG_DATA_DIRS or XDG_DATA_HOME. Fixes: flatpak#906
We use the environment variable to determine the portal configuration, so we need to override it in the tests, to avoid loading the configuration for the system's environment.
Make sure to dump all the debug messages in the test log.
We check under the `DATADIR` prefix for system installations, but we should also check under `$XDG_CONFIG_HOME` for user overrides.
The UseIn key in the portal implementation configuration file is deprecated, and is not a requirement any more. We can still use it as a fallback mechanism while we get per-desktop configuration files.
We need to look first in the user configuration directory, then in the system's configuration directory.
- One argument per line - Align argument type and names in two columns - Use the right-most * to align pointer arguments
Can I ask why XDG_DATA_HOME / XDG_DATA_DIRS was chosen for this config instead of XDG_CONFIG_HOME / XDG_CONFIG_DIRS? Isn't this a user configuration? |
This was an attempt to fix the problem with long start of gtk apps. I hoped that it will disappear due to 1.17.0 containing flatpak/xdg-desktop-portal#955, but gnome portal is still loaded despite not being mentioned in sway-portals.conf. The next commit will have a solution that actually works for me.
This is an example configuration for choosing the portal implementations which should be used [1]. Compositors and distributions are expected to ship their modified version according to their choice of components. [1] flatpak/xdg-desktop-portal#955
With this merged in, if I'm using a |
XDG_CURRENT_DESKTOP affects more than just portal backend selection |
You should not be setting The If you don't have For more information, xdg-desktop-portal ships a |
~~What else is it used for?~~ Please disregard, I missed the second reply above.
|
I'm not using a session governor, so I have to set this manually. With the new |
It's both. The original version in this PR only searched the configuration directories, and my followup #1082 added the data directories as a lower priority. XDG_CONFIG_HOME / XDG_CONFIG_DIRS are read as the highest priority, so that user configuration overrides OS vendor or upstream defaults; but if there is no user or sysadmin configuration, the OS vendor or upstream project for the desktop environment needs to be able to provide reasonable defaults, and those should live in This is exactly the same as |
If you are building a desktop environment out of individual pieces, then yes, it's up to you to be your own system integrator, because there is nobody else in that scenario who can take responsibility for doing this for you.
Again, if you're building a desktop environment out of individual pieces, then it's up to you to carry out the system-integrator role. |
xdg-utils are also using |
As a hint for system integrators who are assembling their own desktop environments, the usual way to set Budgie ( |
@WhyNotHugo See [1] for example, which filters desktop entries as intended by the spec. You should continue to set XDG_CURRENT_DESKTOP. |
Ah, I didn't notice that the config dirs were checked. Thanks. |
Thanks for all the detailed replies! :)
This makes perfect sense. It can be configured by the distribution, overridden by the system administrator and overridden by the end-user in a way that's pretty standard. Should upstream compositors ship the configuration for their portals? Portals like From what I can tell, for general purpose portals (e.g.: darkman, a dark mode / light mode daemon that exposes its value via the settings portal, or xdp-access-portal, a standalone However, given that only the first matching configuration file is used, the user would have to copy their existing one (e.g.: from /etc or /usr) and append any customisations into that (also making sure to keep their copy in sync in future). Wouldn't it be best to read all configuration files, and each one overrides the previous one? So that users can append configurations easily? |
The previous 'UseIn' key was deprecated in xdg-desktop-portal 1.17/1.18. It has been superceded by the portals.conf structure so that each desktop can configure the precise desired structure for portals. In addition, support was added to the Desktop Entry Specifications to support a `DesktopNames` key that login managers will use to set XDG_CURRENT_DESKTOP. * [portals.conf Documentation](https://github.com/flatpak/xdg-desktop-portal/blob/main/doc/portals.conf.rst.in) * [Example sway-portals.conf](https://salsa.debian.org/swaywm-team/sway/-/blob/debian/sid/debian/sway-portals.conf) * [Desktop Entry Specifications](https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html) Ref: flatpak/xdg-desktop-portal#955
The previous `UseIn` key was deprecated in xdg-desktop-portal 1.17/1.18. It has been superceded by the portals.conf structure so that each desktop can configure the precise desired structure for portals. In addition, support was added to the Desktop Entry Specifications to support a `DesktopNames` key that login managers will use to set XDG_CURRENT_DESKTOP. * [portals.conf Documentation](https://github.com/flatpak/xdg-desktop-portal/blob/main/doc/portals.conf.rst.in) * [Example sway-portals.conf](https://salsa.debian.org/swaywm-team/sway/-/blob/debian/sid/debian/sway-portals.conf) * [Desktop Entry Specifications](https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html) Ref: flatpak/xdg-desktop-portal#955
The previous `UseIn` key was deprecated in xdg-desktop-portal 1.17/1.18. It has been superceded by the portals.conf structure so that each desktop can configure the precise desired structure for portals. In addition, support was added to the Desktop Entry Specifications to support a `DesktopNames` key that login managers will use to set XDG_CURRENT_DESKTOP. * [portals.conf Documentation](https://github.com/flatpak/xdg-desktop-portal/blob/main/doc/portals.conf.rst.in) * [Example sway-portals.conf](https://salsa.debian.org/swaywm-team/sway/-/blob/debian/sid/debian/sway-portals.conf) * [Desktop Entry Specifications](https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html) Ref: flatpak/xdg-desktop-portal#955
The previous `UseIn` key was deprecated in xdg-desktop-portal 1.17/1.18. It has been superceded by the portals.conf structure so that each desktop can configure the precise desired structure for portals. In addition, support was added to the Desktop Entry Specifications to support a `DesktopNames` key that login managers will use to set XDG_CURRENT_DESKTOP. * [portals.conf Documentation](https://github.com/flatpak/xdg-desktop-portal/blob/main/doc/portals.conf.rst.in) * [Example sway-portals.conf](https://salsa.debian.org/swaywm-team/sway/-/blob/debian/sid/debian/sway-portals.conf) * [Desktop Entry Specifications](https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html) Ref: flatpak/xdg-desktop-portal#955
The previous `UseIn` key was deprecated in xdg-desktop-portal 1.17/1.18. It has been superceded by the portals.conf structure so that each desktop can configure the precise desired structure for portals. In addition, support was added to the Desktop Entry Specifications to support a `DesktopNames` key that login managers will use to set XDG_CURRENT_DESKTOP. * [portals.conf Documentation](https://github.com/flatpak/xdg-desktop-portal/blob/main/doc/portals.conf.rst.in) * [Example sway-portals.conf](https://salsa.debian.org/swaywm-team/sway/-/blob/debian/sid/debian/sway-portals.conf) * [Desktop Entry Specifications](https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html) Ref: flatpak/xdg-desktop-portal#955
Replace the
UseIn
key in each portal implementation with a per-desktop configuration file.Desktop environments (either upstream or downstream) are supposed to ship the configuration file to describe which portal implementation to use for each portal interface.
Fixes: #906