Skip to content

Settings: Also query GSettings when asked for org.gnome.* properties

Gabriel Souza Franco requested to merge work/gbs/gsettings into master

Sandboxed applications on Wayland were not using the system appearance settings until now. GTK tries only the portal in this case, unlike on X11 where there's also the xsettingsd codepath. GTK does have a fallback1 in case of a DBus error in the portal but the XDP façade never returns one2, making it impossible to trigger from our side. The result is programs always using Adwaita and other hardcoded defaults.

Resolve this by reading GSettings when asked for the org.gnome.* groups. There's support for all basic datatypes and some limited handling of array types. Glib change signals are not used for now, settings are requeried for every request.

BUG: 440354


Before After
❯ GTK_USE_PORTAL=1 gtk-query-settings gtk-theme-name
theme-name: "Adwaita"
❯ GTK_USE_PORTAL=1 gtk-query-settings gtk-theme-name
theme-name: "Breeze"
❯ GTK_USE_PORTAL=0 gtk-query-settings gtk-theme-name
theme-name: "Breeze"
❯ GTK_USE_PORTAL=0 gtk-query-settings gtk-theme-name
theme-name: "Breeze"

There are still some TODOs left, mainly about handling more GVariant types and if we should return all org.gnome.* groups or have some sort of filtering. xdg-desktop-portal-gtk does have a list of entries allowed to be returned, but I don't know if this is really necessary. In that case, what to do with the setting groups outside org.gnome?

Of course, there is also the question if we even want to add a dependency on Gio and this code at all, since xdg-desktop-portal-gtk is not going to be reading kdeglobals in any case.

  1. gdkdisplay-wayland.c

  2. settings.c

Edited by Gabriel Souza Franco

Merge request reports