2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-30 22:16:14 +00:00

Fallback to portal on Linux if QStyleHints::colorScheme is unknown

This commit is contained in:
Ilya Fedin
2024-10-12 09:58:40 +04:00
committed by John Preston
parent f2e0e481de
commit a88f48cd93
3 changed files with 45 additions and 16 deletions

View File

@@ -529,6 +529,8 @@ void ChatBackground::start() {
#if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)
rpl::single(
QGuiApplication::styleHints()->colorScheme()
) | rpl::filter(
rpl::mappers::_1 != Qt::ColorScheme::Unknown
) | rpl::then(
base::qt_signal_producer(
QGuiApplication::styleHints(),
@@ -542,7 +544,9 @@ void ChatBackground::start() {
Core::App().settings().setSystemDarkMode(dark);
}, _lifetime);
#else // Qt >= 6.5.0
Core::App().settings().setSystemDarkMode(Platform::IsDarkMode());
if (const auto dark = Platform::IsDarkMode()) {
Core::App().settings().setSystemDarkMode(dark);
}
#endif // Qt < 6.5.0
}