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

Support org.freedesktop.appearance API for dark/light theme switching #1313

Open
RushingAlien opened this issue Oct 22, 2023 · 6 comments
Open

Comments

@RushingAlien
Copy link

RushingAlien commented Oct 22, 2023

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.
gambar
gambar
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
@lwindolf
Copy link
Owner

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.

@RushingAlien
Copy link
Author

RushingAlien commented Oct 25, 2023

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

@lwindolf
Copy link
Owner

@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?

@RushingAlien
Copy link
Author

RushingAlien commented Oct 28, 2023

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

@RushingAlien
Copy link
Author

RushingAlien commented Oct 28, 2023

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

@lwindolf
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants