emersion / xdg-desktop-portal-wlr

xdg-desktop-portal backend for wlroots
MIT License
591 stars 56 forks source link

Support `org.freedesktop.appearance color-scheme` #173

Closed Seirdy closed 2 years ago

Seirdy commented 2 years ago

The freedesktop settings API recently got support for a color-scheme property that allows users to set preferred color schemes. Current options include dark, light, and no-preference (default). This setting is used by libadwaita apps, and will be used by Elementary.

As for other portals: xdg-desktop-portal-impatience is a standalone implementation. KDE is working on an implementation, and v42 of xdg-desktop-portal-gnome will have support. There's already an open issue for Flutter.

emersion commented 2 years ago

Sorry, this is outside the scope of xdpw. Wayland has no protocol to indicate color scheme preferences. I'd suggest using the standalone impl.

Hubro commented 2 years ago

Sorry, this is outside the scope of xdpw. Wayland has no protocol to indicate color scheme preferences. I'd suggest using the standalone impl.

Could you please elaborate a bit on this comment? I don't understand how the ability to indicate a preferred color scheme is outside the scope of xdpw. If it's in the scope of xdg-desktop-portal-gtk, how it it outside the scope of xdg-desktop-portal-wlr? People who use wl-roots based window managers use xdg-desktop-portal-wlr, not -gnome or -gtk. How can we get system wide color scheme support if xdpw doesn't implement the Settings interface?

The standalone implementation linked to by @Seirdy appears to be a test implementation made to help developers implement support for the new setting, it doesn't appear to be intended for end-users. My guess is that it will die off as soon as the setting is implemented in xdg-desktop-portal-gtk/gnome. I also can't find it in any package repositories, so it has to be built from source.

EDIT: After reading up on portals a bit more, it seems like xdg-desktop-portal-gtk should work under Sway as well, even though the portal file specifies UseIn=gnome. It seems like this is just a priority hint. In that case, that answers most of my questions above.

A6GibKm commented 2 years ago

Wayland has no protocol to indicate color scheme preferences

I don't think this setting is related in any way to wayland.

It is just an integer flag that apps read to determine which color scheme to use, this can be read by electron, gtk, qt, etc.

Hubro commented 2 years ago

Darkman works as a standalone implementation, providing the color-scheme property:

https://gitlab.com/WhyNotHugo/darkman

Seems like an ideal choice for wl-roots based window managers that don't implement this themselves.