Support org.freedesktop.appearance API for dark/light theme switching
RushingAlien opened this issue · 6 comments
Hello, GNOME, KDE, and other DEs have adopted a standard, desktop agnostic API for deciding themes, GNOME even goes so far as to make their dark settings that's not in gnome-tweaks only set dark/light this way.
Both of these toggle set dark theme only via the org.freedesktop.appearance API, hence issue #1275, the API used in gnome-tweaks is not touched through these toggles and is considered unsupported usecase
The API:
https://flatpak.github.io/xdg-desktop-portal/docs/#gdbus-org.freedesktop.portal.Settings
And don't worry, the API works outside of Flatpak
Apps that have implemented this API
- Firefox
- LibreOffice
- Libadwaita apps
- Libhandy apps
- Chromium
- Kirigami
- KDE Frameworks Apps
This is already implemented. Relevant code can be found in src/conf.c:286
#1275 is a strange issue, but not caused by not implementing the FreeDesktop portal support.
I also experience issue #1275 .
Okay, seeing the code, doesn't look like it consults with portal and d-bus to fetch theme values?
As far as I am aware, the portal settings is not a gschema, but communicated through d-bus
to reproduce
- set light theme in gnome-tweaks
- set dark theme in gnome-control-center or shell quick settings
@RushingAlien I was maybe naivly expecting both interfaces GDBUS endpoint and GSettings schema to report the same setting value. If both places report different values how is the app to behave?
About reproducing: can you elaborate a bit more? Do you run in Flatpak or is the effect visible without Flatpak too?
Hello again, Sorry for the late reply.
I don't think portals has a GSettings schema endpoint at all
And to answer your question:
About reproducing: can you elaborate a bit more? Do you run in Flatpak or is the effect visible without Flatpak too?
I have reproduced issue in both flatpak and non-flatpak
I'm guessing you are using Ubuntu? Ubuntu downstreams a lot hacks to make things work
I don't think portals has a GSettings schema endpoint at all
This confirms my suspicion
liferea/src on fdo-dark [!?] via C v13.2.1-gcc
➜ LANG=en_US.UTF-8 ./liferea
(net.sourceforge.liferea:182875): GLib-GIO-ERROR **: 16:54:38.741: Settings schema 'org.freedesktop.appearance' is not installed
Jejak/titik-putus jebakan (core didump)
I remove the conditional for the fdo codepath in liferea
I can't see anything in dconf-editor
either
What we have however is /org/gnome/desktop/interface/color-scheme
which is a gnome gsettings schema that controls the fdo settings(dbus)
apps then are expected to read the fdo settings
Of course, thiss means KDE has a different trigger for fdo settings
probably doesn't use gsettings at all
Given the implementation by libadwaita (https://gitlab.gnome.org/GNOME/libadwaita/-/blob/main/src/adw-settings-impl-portal.c) we should entirely switch to DBUS only too. It is easier to maintain.