mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-08-31 14:38:15 +00:00
Implement system-based dark mode for Windows and Linux
This commit is contained in:
@@ -902,6 +902,19 @@ void MainMenu::refreshMenu() {
|
||||
*_nightThemeAction = action;
|
||||
action->setCheckable(true);
|
||||
action->setChecked(Window::Theme::IsNightMode());
|
||||
Core::App().settings().systemDarkModeValue(
|
||||
) | rpl::start_with_next([=](std::optional<bool> darkMode) {
|
||||
const auto darkModeEnabled = Core::App().settings().systemDarkModeEnabled();
|
||||
if (darkModeEnabled && darkMode.has_value()) {
|
||||
action->setChecked(*darkMode);
|
||||
}
|
||||
action->setEnabled(!darkModeEnabled || !darkMode.has_value());
|
||||
}, lifetime());
|
||||
Core::App().settings().systemDarkModeEnabledChanges(
|
||||
) | rpl::start_with_next([=](bool darkModeEnabled) {
|
||||
const auto darkMode = Core::App().settings().systemDarkMode();
|
||||
action->setEnabled(!darkModeEnabled || !darkMode.has_value());
|
||||
}, lifetime());
|
||||
_menu->finishAnimating();
|
||||
|
||||
updatePhone();
|
||||
|
Reference in New Issue
Block a user