mirror of
https://github.com/DYefremov/DemonEditor.git
synced 2026-07-14 05:33:46 +02:00
added auto setting of the dark mode
This commit is contained in:
@@ -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):
|
||||
|
||||
@@ -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">
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user