From 49f62a323984dd1e425d17b3aa290ebef2af1a1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anti=20R=C3=A4is?= Date: Mon, 2 Oct 2023 10:50:46 +0300 Subject: [PATCH] enable dark theme (#263) --- src/controller/application.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/controller/application.cpp b/src/controller/application.cpp index cc9341d7..c8a56f37 100644 --- a/src/controller/application.cpp +++ b/src/controller/application.cpp @@ -82,10 +82,11 @@ bool Application::isDarkTheme() "HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize", QSettings::NativeFormat); return settings.value("AppsUseLightTheme", 1).toInt() == 0; -#elif 0 // Disabled as there is currently no straightforward way to detect dark mode in Linux. +#else + // There is currently no straightforward way to detect dark mode in Linux, but this works for supported OS-s. static const bool isDarkTheme = [] { QProcess p; - p.start(QStringLiteral("gsettings"), {"get", "org.gnome.desktop.interface", "gtk-theme"}); + p.start(QStringLiteral("gsettings"), {"get", "org.gnome.desktop.interface", "color-scheme"}); if (p.waitForFinished()) { return p.readAllStandardOutput().contains("dark"); } @@ -94,8 +95,6 @@ bool Application::isDarkTheme() return text_hsv_value > bg_hsv_value; }(); return isDarkTheme; -#else - return false; #endif } #endif