2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 22:46:10 +00:00

Add 'respect system dark mode' checkbox.

This commit is contained in:
John Preston
2020-07-22 16:10:17 +04:00
parent c24da4c3df
commit 8c4e8212cd
26 changed files with 298 additions and 151 deletions

View File

@@ -69,6 +69,8 @@ constexpr auto kPropertiesInterface = "org.freedesktop.DBus.Properties"_cs;
QStringList PlatformThemes;
bool IsTrayIconSupported = true;
#ifndef TDESKTOP_DISABLE_DBUS_INTEGRATION
void PortalAutostart(bool autostart, bool silent = false) {
QVariantMap options;
@@ -871,8 +873,7 @@ std::optional<crl::time> LastUserInputTime() {
std::optional<bool> IsDarkMode() {
#ifndef TDESKTOP_DISABLE_GTK_INTEGRATION
if (Libs::GtkSettingSupported()
&& Libs::GtkLoaded()) {
if (Libs::GtkSettingSupported() && Libs::GtkLoaded()) {
if (Libs::gtk_check_version != nullptr
&& !Libs::gtk_check_version(3, 0, 0)
&& Libs::GtkSetting<gboolean>("gtk-application-prefer-dark-theme")) {
@@ -897,6 +898,14 @@ bool AutostartSupported() {
return !InSnap();
}
bool TrayIconSupported() {
return IsTrayIconSupported;
}
void SetTrayIconSupported(bool supported) {
IsTrayIconSupported = supported;
}
void FallbackFontConfigCheckBegin() {
if (!CheckFontConfigCrash()) {
return;