diff --git a/app/settings.py b/app/settings.py index 0062753e..69da0d6c 100644 --- a/app/settings.py +++ b/app/settings.py @@ -655,6 +655,13 @@ class Settings: @property def dark_mode(self): + if IS_DARWIN: + import subprocess + + cmd = ["defaults", "read", "-g", "AppleInterfaceStyle"] + p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate() + return "Dark" in str(p[0]) + return self._settings.get("dark_mode", False) @dark_mode.setter diff --git a/app/ui/settings_dialog.glade b/app/ui/settings_dialog.glade index 1a22a2f1..fb87cd21 100644 --- a/app/ui/settings_dialog.glade +++ b/app/ui/settings_dialog.glade @@ -2782,6 +2782,7 @@ Author: Dmitriy Yefremov 5 + True False @@ -2817,7 +2818,7 @@ Author: Dmitriy Yefremov - True + False False Enables an alternate layout of the main window elements. diff --git a/app/ui/settings_dialog.py b/app/ui/settings_dialog.py index ff3701f6..eebb3049 100644 --- a/app/ui/settings_dialog.py +++ b/app/ui/settings_dialog.py @@ -31,7 +31,7 @@ import re from app.commons import run_task, run_idle, log from app.connections import test_telnet, test_ftp, TestException, test_http, HttpApiException -from app.settings import SettingsType, Settings, PlayStreamsMode, IS_LINUX, SEP +from app.settings import SettingsType, Settings, PlayStreamsMode, IS_LINUX, SEP, IS_WIN from app.ui.dialogs import show_dialog, DialogType, get_message, get_chooser_dialog, get_builder from .main_helper import update_entry_data, scroll_to, get_picon_pixbuf from .uicommons import Gtk, Gdk, UI_RESOURCES_PATH, FavClickMode, DEFAULT_ICON, APP_FONT @@ -210,7 +210,7 @@ class SettingsDialog: if not IS_LINUX: # Themes. - builder.get_object("style_frame").set_visible(True) + builder.get_object("style_frame").set_visible(IS_WIN) builder.get_object("themes_support_frame").set_visible(True) self._layout_switch = builder.get_object("layout_switch") self._layout_switch.set_active(self._ext_settings.alternate_layout) @@ -220,6 +220,7 @@ class SettingsDialog: self._theme_combo_box = builder.get_object("theme_combo_box") self._icon_theme_combo_box = builder.get_object("icon_theme_combo_box") self._dark_mode_switch = builder.get_object("dark_mode_switch") + self._dark_mode_switch.set_active(self._ext_settings.dark_mode) self._themes_support_switch = builder.get_object("themes_support_switch") self._themes_support_switch.bind_property("active", self._theme_frame, "sensitive") self.init_themes() @@ -386,6 +387,7 @@ class SettingsDialog: self._ext_settings.list_font = self._list_font_button.get_font() if not IS_LINUX: + 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()