Commit 62c0f53b authored by Jeremy Bicha's avatar Jeremy Bicha 🎹

widgets: Enable Dark Theme for gtk4 too

https://bugzilla.gnome.org/show_bug.cgi?id=780915
parent e3249e58
......@@ -26,11 +26,10 @@ SETTINGS_GROUP_NAME = "Settings"
LOG = logging.getLogger(__name__)
@gtweak.utils.singleton
class GtkSettingsManager:
def __init__(self):
def __init__(self, version):
self._path = os.path.join(GLib.get_user_config_dir(),
"gtk-3.0",
"gtk-" + version,
"settings.ini")
def _get_keyfile(self):
keyfile = None
......
......@@ -501,10 +501,11 @@ class DarkThemeSwitcher(Gtk.Box, Tweak):
_("Enable the dark theme hint for all the applications in the session"),
**options)
self._gtksettings = GtkSettingsManager()
self._gtksettings3 = GtkSettingsManager('3.0')
self._gtksettings4 = GtkSettingsManager('4.0')
w = Gtk.Switch()
w.set_active(self._gtksettings.get_integer("gtk-application-prefer-dark-theme"))
w.set_active(self._gtksettings3.get_integer("gtk-application-prefer-dark-theme"))
title = _("Global Dark Theme")
description = _("Applications need to be restarted for this change to take place.")
......@@ -531,7 +532,9 @@ class DarkThemeSwitcher(Gtk.Box, Tweak):
active = switch.get_active()
try:
self._gtksettings.set_integer("gtk-application-prefer-dark-theme",
self._gtksettings3.set_integer("gtk-application-prefer-dark-theme",
active)
self._gtksettings4.set_integer("gtk-application-prefer-dark-theme",
active)
except:
self.notify_information(_("Error writing setting"))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment