diff --git a/src/appBase.js b/src/appBase.js index 0a40d6c9..be72d61d 100644 --- a/src/appBase.js +++ b/src/appBase.js @@ -96,13 +96,6 @@ class ClapperAppBase extends Gtk.Application if(accels) this.set_accels_for_action(`app.${name}`, accels); } - - const gtkSettings = Gtk.Settings.get_default(); - settings.bind( - 'dark-theme', gtkSettings, - 'gtk-application-prefer-dark-theme', - Gio.SettingsBindFlags.GET - ); this.doneFirstActivate = true; } }); diff --git a/src/player.js b/src/player.js index be0aeae3..5e06b468 100644 --- a/src/player.js +++ b/src/player.js @@ -1,4 +1,4 @@ -const { Gdk, Gio, GObject, Gst, GstClapper, Gtk } = imports.gi; +const { Adw, Gdk, Gio, GObject, Gst, GstClapper, Gtk } = imports.gi; const ByteArray = imports.byteArray; const Debug = imports.src.debug; const Misc = imports.src.misc; @@ -74,6 +74,7 @@ class ClapperPlayer extends GstClapper.Clapper set_and_bind_settings() { const settingsToSet = [ + 'dark-theme', 'after-playback', 'seeking-mode', 'audio-offset', @@ -657,6 +658,19 @@ class ClapperPlayer extends GstClapper.Clapper break; } break; + case 'dark-theme': + /* TODO: Remove libadwaita alpha2 compat someday */ + if (Adw.StyleManager != null) { + const styleManager = Adw.StyleManager.get_default(); + styleManager.color_scheme = (settings.get_boolean(key)) + ? Adw.ColorScheme.FORCE_DARK + : Adw.ColorScheme.FORCE_LIGHT; + } + else { + const gtkSettings = Gtk.Settings.get_default(); + gtkSettings.gtk_application_prefer_dark_theme = settings.get_boolean(key); + } + break; case 'render-shadows': root = this.widget.get_root(); if(!root) break;