summaryrefslogtreecommitdiff
path: root/vcl/inc
diff options
context:
space:
mode:
authorMichael Weghorn <m.weghorn@posteo.de>2023-09-02 10:12:54 +0200
committerMichael Weghorn <m.weghorn@posteo.de>2023-09-02 15:42:37 +0200
commit73d0d205c43a9848acd313ff1845ebafe63e807c (patch)
tree7ad450c12c0c7240e37db63b0019b75e46531ebd /vcl/inc
parentbdf2d664784b3ebe3e7078b9ec82a02d09d9ded8 (diff)
tdf#156894 qt: Prefer dark icon theme in dark mode
When in dark mode, pass the param to prefer a dark icon theme to `StyleSettings::SetPreferredIconTheme`. For Qt >= 6.5 use `QStyleHints::colorScheme` introduced in Qt 6.5 to get the color scheme. For older Qt versions, use the same algorithm based on the gray value of the window background as xdg-desktop-portal-kde does for evaluating whether a light or dark color scheme is preferred [1]. On my Debian testing, the Breeze dark icon theme is now used as expected with kf5 or qt6 when setting the Global KDE Plasma theme to "Breeze Dark" and manually setting the Icon theme to "GNOME" afterwards. Previously, this would not use a dark icon theme and icons would be hard to see. Without manually setting the icon theme to "GNOME", the Breeze Dark icon theme would already be used before, because selecting "Breeze Dark" as the global KDE Plasma theme also selects the "Breeze Dark" icon theme by default, and therefore "breeze-dark" was already passed as the first param to `StyleSettings::SetPreferredIconTheme` and since that icon theme is present, the `bPreferDarkTheme` wouldn't be evaluated at all; it's only used when determining the fallback icon theme when the specified icon theme is not present. (Likewise, by enabling the "Breeze Dark" global theme and then manually setting the icon theme to "Breeze" in Plasma System settings, the Breeze light icon theme will be used in LibreOffice as well, resulting in hard to see icons, but I tend to think that that behavior is correct and works as designed - it's a misconfiguration.) The color scheme is also specified in xdg-desktop-portal (s. commit [2]) and can be retrived via dbus. Example with "Breeze Light" active: $ dbus-send --session --print-reply=literal --reply-timeout=1000 --dest=org.freedesktop.portal.Desktop /org/freedesktop/portal/desktop org.freedesktop.portal.Settings.Read string:'org.freedesktop.appearance' string:'color-scheme' variant variant uint32 2 With "Breeze Dark": $ dbus-send --session --print-reply=literal --reply-timeout=1000 --dest=org.freedesktop.portal.Desktop /org/freedesktop/portal/desktop org.freedesktop.portal.Settings.Read string:'org.freedesktop.appearance' string:'color-scheme' variant variant uint32 1 [1] https://invent.kde.org/plasma/xdg-desktop-portal-kde/-/blob/0a4237549debf9518f8cfbaf531456850c0729bd/src/settings.cpp#L213-227 [2] https://github.com/flatpak/xdg-desktop-portal/commit/d7a304a00697d7d608821253cd013f3b97ac0fb6 Change-Id: I8f347c6e7f775cc55377c5c84481de3051c3cf24 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156465 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Diffstat (limited to 'vcl/inc')
-rw-r--r--vcl/inc/qt5/QtFrame.hxx1
1 files changed, 1 insertions, 0 deletions
diff --git a/vcl/inc/qt5/QtFrame.hxx b/vcl/inc/qt5/QtFrame.hxx
index 02146343e10d..ecedc3ae2e29 100644
--- a/vcl/inc/qt5/QtFrame.hxx
+++ b/vcl/inc/qt5/QtFrame.hxx
@@ -128,6 +128,7 @@ class VCLPLUG_QT_PUBLIC QtFrame : public QObject, public SalFrame
bool isWindow() const;
QWindow* windowHandle() const;
QScreen* screen() const;
+ static bool isUsingDarkColorScheme();
bool isMinimized() const;
bool isMaximized() const;
void SetWindowStateImpl(Qt::WindowStates eState);