diff --git a/app/settings.py b/app/settings.py
index d3a53300..81148df2 100644
--- a/app/settings.py
+++ b/app/settings.py
@@ -612,6 +612,14 @@ class Settings:
# *********** Appearance *********** #
+ @property
+ def dark_mode(self):
+ return self._settings.get("dark_mode", False)
+
+ @dark_mode.setter
+ def dark_mode(self, value):
+ self._settings["dark_mode"] = value
+
@property
def is_themes_support(self):
return self._settings.get("is_themes_support", False)
diff --git a/app/ui/settings_dialog.glade b/app/ui/settings_dialog.glade
index dc95966c..7463d645 100644
--- a/app/ui/settings_dialog.glade
+++ b/app/ui/settings_dialog.glade
@@ -2461,6 +2461,57 @@ Author: Dmitriy Yefremov
5
vertical
5
+
+
+
+ False
+ True
+ 0
+
+
True
@@ -2470,7 +2521,6 @@ Author: Dmitriy Yefremov
True
- False
False
5
5
@@ -2488,6 +2538,18 @@ Author: Dmitriy Yefremov
0
+
+
+ True
+ False
+ EXPERIMENTAL!
+
+
+ False
+ True
+ 2
+
+
True
@@ -2510,7 +2572,7 @@ Author: Dmitriy Yefremov
False
True
- 0
+ 1
@@ -2657,7 +2719,47 @@ Author: Dmitriy Yefremov
False
True
- 1
+ 2
+
+
+
+
+ True
+ False
+ center
+
+
+ True
+ False
+ Gtk3 Themes and Icons:
+
+
+ False
+ True
+ 0
+
+
+
+
+ www.gnome-look.org
+ True
+ True
+ True
+ none
+ https://www.gnome-look.org/
+
+
+ False
+ True
+ 1
+
+
+
+
+ False
+ True
+ end
+ 3
@@ -2753,47 +2855,7 @@ Author: Dmitriy Yefremov
False
True
- 2
-
-
-
-
- True
- False
- center
-
-
- True
- False
- Gtk3 Themes and Icons:
-
-
- False
- True
- 0
-
-
-
-
- www.gnome-look.org
- True
- True
- True
- none
- https://www.gnome-look.org/
-
-
- False
- True
- 1
-
-
-
-
- False
- True
- end
- 3
+ 4
diff --git a/app/ui/settings_dialog.py b/app/ui/settings_dialog.py
index 3ad362d8..9fe6d85a 100644
--- a/app/ui/settings_dialog.py
+++ b/app/ui/settings_dialog.py
@@ -195,6 +195,7 @@ class SettingsDialog:
self._theme_thumbnail_image = builder.get_object("theme_thumbnail_image")
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._themes_support_switch = builder.get_object("themes_support_switch")
self._themes_support_switch.bind_property("active", builder.get_object("gtk_theme_frame"), "sensitive")
self._themes_support_switch.bind_property("active", builder.get_object("icon_theme_frame"), "sensitive")
@@ -359,6 +360,7 @@ class SettingsDialog:
self._ext_settings.active_preset = self._presets_combo_box.get_active_id()
if self._ext_settings.is_darwin:
+ self._ext_settings.dark_mode = self._dark_mode_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()
self._ext_settings.icon_theme = self._icon_theme_combo_box.get_active_id()
@@ -699,7 +701,9 @@ class SettingsDialog:
self.add_theme(self._ext_settings.themes_path, self._theme_combo_box)
def on_theme_remove(self, button):
- self.remove_theme(self._theme_combo_box, self._ext_settings.themes_path)
+ if show_dialog(DialogType.QUESTION, self._dialog) == Gtk.ResponseType.OK:
+ Gtk.Settings().get_default().set_property("gtk-theme-name", "")
+ self.remove_theme(self._theme_combo_box, self._ext_settings.themes_path)
def on_icon_theme_changed(self, button, state=False):
if self._main_stack.get_visible_child_name() != "appearance":
@@ -710,7 +714,9 @@ class SettingsDialog:
self.add_theme(self._ext_settings.icon_themes_path, self._icon_theme_combo_box)
def on_icon_theme_remove(self, button):
- self.remove_theme(self._icon_theme_combo_box, self._ext_settings.icon_themes_path)
+ if show_dialog(DialogType.QUESTION, self._dialog) == Gtk.ResponseType.OK:
+ Gtk.Settings().get_default().set_property("gtk-icon-theme-name", "")
+ self.remove_theme(self._icon_theme_combo_box, self._ext_settings.icon_themes_path)
@run_idle
def add_theme(self, path, button):
@@ -723,14 +729,17 @@ class SettingsDialog:
@run_task
def unpack_theme(self, src, dst, button):
try:
- from shutil import unpack_archive
+ os.makedirs(os.path.dirname(dst), exist_ok=True)
- unpack_archive(src, dst)
- except (KeyError, EOFError) as e:
- self.show_info_message(str(e), Gtk.MessageType.ERROR)
- else:
- self.update_theme_button(button, dst)
+ import subprocess
+ log("Unpacking '{}' started...".format(src))
+ p = subprocess.Popen(["tar", "-xvf", src, "-C", dst],
+ stdout=subprocess.PIPE,
+ stderr=subprocess.STDOUT)
+ p.communicate()
+ log("Unpacking end.")
finally:
+ self.update_theme_button(button, dst)
self._appearance_box.set_sensitive(True)
@run_idle
@@ -752,9 +761,6 @@ class SettingsDialog:
self.show_info_message("No selected item!", Gtk.MessageType.ERROR)
return
- if show_dialog(DialogType.QUESTION, self._dialog) != Gtk.ResponseType.OK:
- return
-
from shutil import rmtree
try:
@@ -762,11 +768,16 @@ class SettingsDialog:
except OSError as e:
self.show_info_message(str(e), Gtk.MessageType.ERROR)
else:
- button.remove(button.get_active())
- button.set_active(0)
+ self.theme_button_remove_active(button)
+
+ @run_idle
+ def theme_button_remove_active(self, button):
+ button.remove(button.get_active())
+ button.set_active(0)
@run_idle
def init_appearance(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: