From 7e8cbeeb715a5909cd13f0ce6bf9ba2378b17dec Mon Sep 17 00:00:00 2001 From: Robert Tari Date: Fri, 7 Jul 2023 07:59:55 +0200 Subject: ayatana-settings: Add colour scheme handler --- ayatana-settings | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/ayatana-settings b/ayatana-settings index 78db62a..ded25a9 100755 --- a/ayatana-settings +++ b/ayatana-settings @@ -46,8 +46,13 @@ class AyatanaSettings: buildApp(self) + self.pGnomeSettings = Gio.Settings.new ('org.gnome.desktop.interface') + self.pGnomeSettings.connect ('changed::color-scheme', self.onColorSchemeChanged) + self.onColorSchemeChanged (self.pGnomeSettings, 'color-scheme') + self.bSystemd = isSystemd() self.bInit = False + try: self.sDesktop = os.environ['XDG_CURRENT_DESKTOP'] except KeyError: @@ -338,6 +343,12 @@ class AyatanaSettings: self.pSettingsNotifications.set_strv('filter-list', lItems) + def onColorSchemeChanged (self, pSettings, sKey): + + sColorScheme = pSettings.get_string (sKey) + bDark = (sColorScheme == 'prefer-dark') + Gtk.Settings.get_default().props.gtk_application_prefer_dark_theme = bDark + if __name__ == "__main__": AyatanaSettings() -- cgit v1.2.3