added auto setting of the dark mode

This commit is contained in:
DYefremov
2021-04-24 00:02:26 +03:00
parent b4bca084de
commit 7cb1787de7
3 changed files with 7 additions and 4 deletions

View File

@@ -617,8 +617,13 @@ class Settings:
self._settings["extra_color"] = value
@property
@lru_cache(1)
def dark_mode(self):
return self._settings.get("dark_mode", False)
import subprocess
cmd = ["defaults", "read", "-g", "AppleInterfaceStyle"]
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()
return "Dark" in str(p[0])
@dark_mode.setter
def dark_mode(self, value):

View File

@@ -2686,7 +2686,7 @@ Author: Dmitriy Yefremov
<property name="spacing">5</property>
<child>
<object class="GtkBox" id="dark_mode_box">
<property name="visible">True</property>
<property name="visible">False</property>
<property name="can_focus">False</property>
<child>
<object class="GtkLabel" id="dark_mode_label">

View File

@@ -356,7 +356,6 @@ class SettingsDialog:
self._ext_settings.list_font = self._list_font_button.get_font()
if self._ext_settings.is_darwin:
self._ext_settings.dark_mode = self._dark_mode_switch.get_active()
self._ext_settings.alternate_layout = self._layout_switch.get_active()
self._ext_settings.is_themes_support = self._themes_support_switch.get_active()
self._ext_settings.theme = self._theme_combo_box.get_active_id()
@@ -794,7 +793,6 @@ class SettingsDialog:
@run_idle
def init_themes(self):
self._dark_mode_switch.set_active(self._ext_settings.dark_mode)
t_support = self._ext_settings.is_themes_support
self._themes_support_switch.set_active(t_support)
if t_support: