-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Implement org.freedesktop.appearance.color-scheme support on Linux #7422
Conversation
The new org.freedesktop.appearance.color-scheme key allows us to do this in a reliable way. Recently freedesktop standardized the system dark mode preference in a desktop environment independent way in the xdg-desktop-portal specification. The specification can be seen here: https://github.com/flatpak/xdg-desktop-portal/blob/d7a304a00697d7d608821253cd013f3b97ac0fb6/data/org.freedesktop.impl.portal.Settings.xml#L33-L45 KDE supports this since KDE Plasma 5.24 and Gnome supports this since Gnome 42. Relevant blog post: https://blogs.gnome.org/alexm/2021/10/04/dark-style-preference/ Fixes keepassxreboot#7146
Awesome! |
Codecov Report
@@ Coverage Diff @@
## develop #7422 +/- ##
===========================================
+ Coverage 64.33% 64.33% +0.01%
===========================================
Files 339 339
Lines 43199 43216 +17
===========================================
+ Hits 27788 27802 +14
- Misses 15411 15414 +3
Continue to review full report at Codecov.
|
FYI I think Gnome might be violating their own spec, i.e. they return "No preference" instead of "Prefers light theme" when the user explicitly chooses a light theme. I am not completely sure about this, and since Gnome 42 hasn't been released yet, it can still change, but it is something to keep in mind. The problem would be easy to fix (just interpet "No preference" as light preference), however I think Gnome should just report the correct preference ("prefers light theme") in the first place instead of shipping such a broken Portal implementation. |
Have you filed a bug report with them? |
Well not yet, as I am not sure if my assumption is even true. I only assume this, because their blog post was hinting towards this, I yet have to await the Gnome release to see if it's actually the case. |
This finally allows us to follow the system theme without restart in a reliable and desktop-environment independent way.
This uses the new standardized
org.freedesktop.appearance.color-scheme
key to accomplish this.The following DEs already support this in the respective version:
In addition to that, the
xdg-deskop-portal
user service needs to be running.Relevant blog post: https://blogs.gnome.org/alexm/2021/10/04/dark-style-preference/
Properly fixes #7146 (was closed as it was basically impossible to implement this in a reliable way a few years back)
Note that if the user does not have xdg-desktop-portal or is missing support for that specific key, the previous behaviour is unchanged.
Short demo:
demo.mp4
Type of change