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

Make the search order for portals.conf consistent with mimeapps.list #1082

Merged
merged 1 commit into from
Aug 24, 2023

Conversation

smcv
Copy link
Collaborator

@smcv smcv commented Aug 24, 2023

Previously, we would search for a user-specific portals.conf as highest precedence, and then iterate through desktop environments, searching for a user-specific desktop-specific file followed by a system-wide desktop-specific file. Now, the precedence order is consistently that directories are most important, we only pay attention to desktop environments within a single directory, and desktop-specific configuration is always higher-precedence than generic within the same directory.

Previously, desktop environments and OS vendors had to install their per-desktop configuration into /etc, contradicting the general design principle of putting defaults in /usr and reserving /etc for sysadmin overrides. Now, we search both /etc and /usr/share (with typical environment variables and build-time settings).

Previously, we didn't fully follow the XDG Base Directory specification when looking up per-user configuration; now we do. This is potentially significant for users who have more than one per-user directory, for example a machine-specific directory within a home directory shared between machines.

Update documentation accordingly.

Resolves: #1081

Previously, we would search for a user-specific portals.conf as
highest precedence, and then iterate through desktop environments,
searching for a user-specific desktop-specific file followed by a
system-wide desktop-specific file. Now, the precedence order is
consistently that directories are most important, we only pay
attention to desktop environments within a single directory, and
desktop-specific configuration is always higher-precedence than generic
within the same directory.

Previously, desktop environments and OS vendors had to install their
per-desktop configuration into /etc, contradicting the general design
principle of putting defaults in /usr and reserving /etc for sysadmin
overrides. Now, we search both /etc and /usr/share (with typical
environment variables and build-time settings).

Previously, we didn't fully follow the XDG Base Directory specification
when looking up per-user configuration; now we do. This is potentially
significant for users who have more than one per-user directory, for
example a machine-specific directory within a home directory shared
between machines.

Update documentation accordingly.

Resolves: flatpak#1081
Signed-off-by: Simon McVittie <smcv@collabora.com>
const char **desktops;
const char *portal_dir;

desktops = get_current_lowercase_desktops ();

/* We need to override this in the tests */
portal_dir = g_getenv ("XDG_DESKTOP_PORTAL_DIR");
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left this as an intentionally undocumented implementation detail, since it's only there for the tests as far as I can see.

Comment on lines +495 to +497
/* ${datadir}/xdg-desktop-portal/(DESKTOP-)portals.conf */
if (load_config_directory (DATADIR "/" XDP_SUBDIR, desktops, opt_verbose))
return;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In practice this is redundant with XDG_DATA_DIRS but I thought we should probably search it anyway?

Copy link
Member

@GeorgesStavracas GeorgesStavracas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, it works. Thanks Simon, this is looking excellent

@GeorgesStavracas GeorgesStavracas added this pull request to the merge queue Aug 24, 2023
Merged via the queue into flatpak:main with commit e7027b7 Aug 24, 2023
3 checks passed
@smcv
Copy link
Collaborator Author

smcv commented Aug 24, 2023

It doesn't need to be immediately, but I'd like to get a 1.17.1 out with this change at some point, so that when we start asking desktop environment maintainers (upstream or downstream) to install their own foo-portals.conf we can ask them to install it as /usr/share/xdg-desktop-portal/foo-portals.conf, reserving /etc for the sysadmin (in the same spirit as how libeconf and systemd behave).

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

Successfully merging this pull request may close these issues.

Search path for portals.conf
2 participants