[gnome-shell/wip/exalm/dark-3] background: Support dark wallpapers
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/wip/exalm/dark-3] background: Support dark wallpapers
- Date: Sun, 30 Jan 2022 15:57:13 +0000 (UTC)
commit 15896bbf0c8cffecb357e09fb5f292d0a3152871
Author: Alexander Mikhaylenko <alexm gnome org>
Date: Sat Nov 27 17:53:14 2021 +0500
background: Support dark wallpapers
See https://gitlab.gnome.org/GNOME/gnome-control-center/-/merge_requests/1174
js/ui/background.js | 23 ++++++++++++++++++++++-
1 file changed, 22 insertions(+), 1 deletion(-)
---
diff --git a/js/ui/background.js b/js/ui/background.js
index 1f7c5e5720..2958eb0b38 100644
--- a/js/ui/background.js
+++ b/js/ui/background.js
@@ -111,6 +111,10 @@ const SECONDARY_COLOR_KEY = 'secondary-color';
const COLOR_SHADING_TYPE_KEY = 'color-shading-type';
const BACKGROUND_STYLE_KEY = 'picture-options';
const PICTURE_URI_KEY = 'picture-uri';
+const PICTURE_URI_DARK_KEY = 'picture-uri-dark';
+
+const INTERFACE_SCHEMA = 'org.gnome.desktop.interface';
+const COLOR_SCHEME_KEY = 'color-scheme';
var FADE_ANIMATION_TIME = 1000;
@@ -230,12 +234,14 @@ var Background = GObject.registerClass({
params = Params.parse(params, { monitorIndex: 0,
layoutManager: Main.layoutManager,
settings: null,
+ interfaceSettings: null,
file: null,
style: null });
super._init({ meta_display: global.display });
this._settings = params.settings;
+ this._interfaceSettings = params.interfaceSettings;
this._file = params.file;
this._style = params.style;
this._monitorIndex = params.monitorIndex;
@@ -262,6 +268,9 @@ var Background = GObject.registerClass({
this._settingsChangedSignalId =
this._settings.connect('changed', this._emitChangedSignal.bind(this));
+ this._colorSchemeChangedSignalId =
+ this._interfaceSettings.connect('changed::color-scheme', this._emitChangedSignal.bind(this));
+
this._load();
}
@@ -290,6 +299,10 @@ var Background = GObject.registerClass({
this._settings.disconnect(this._settingsChangedSignalId);
this._settingsChangedSignalId = 0;
+ if (this._colorSchemeChangedSignalId != 0)
+ this._interfaceSettings.disconnect(this._colorSchemeChangedSignalId);
+ this._colorSchemeChangedSignalId = 0;
+
if (this._changedIdleId) {
GLib.source_remove(this._changedIdleId);
this._changedIdleId = 0;
@@ -546,6 +559,8 @@ var BackgroundSource = class BackgroundSource {
this._monitorsChangedId =
monitorManager.connect('monitors-changed',
this._onMonitorsChanged.bind(this));
+
+ this._interfaceSettings = new Gio.Settings({ schema_id: INTERFACE_SCHEMA });
}
_onMonitorsChanged() {
@@ -576,7 +591,12 @@ var BackgroundSource = class BackgroundSource {
} else {
style = this._settings.get_enum(BACKGROUND_STYLE_KEY);
if (style != GDesktopEnums.BackgroundStyle.NONE) {
- let uri = this._settings.get_string(PICTURE_URI_KEY);
+ let uri;
+ let colorScheme = this._interfaceSettings.get_enum('color-scheme');
+ if (colorScheme == 1) // GDesktopEnums.ColorScheme.PREFER_DARK
+ uri = this._settings.get_string(PICTURE_URI_DARK_KEY);
+ else
+ uri = this._settings.get_string(PICTURE_URI_KEY);
file = Gio.File.new_for_commandline_arg(uri);
}
}
@@ -593,6 +613,7 @@ var BackgroundSource = class BackgroundSource {
monitorIndex,
layoutManager: this._layoutManager,
settings: this._settings,
+ interfaceSettings: this._interfaceSettings,
file,
style,
});
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]