Directly use gsettings

This commit is contained in:
Romain Vigier
2021-08-25 15:17:41 +02:00
parent 8a638c7a3c
commit 4594ebfca7
25 changed files with 458 additions and 1583 deletions
-1
View File
@@ -18,7 +18,6 @@ build:
--extra-source=./modules/ \ --extra-source=./modules/ \
--extra-source=./preferences/ \ --extra-source=./preferences/ \
--extra-source=./schemas/ \ --extra-source=./schemas/ \
--extra-source=./settings/ \
--podir=./po/ \ --podir=./po/ \
--gettext-domain=$(DOMAIN) \ --gettext-domain=$(DOMAIN) \
--out-dir=./build \ --out-dir=./build \
-6
View File
@@ -10,7 +10,6 @@ const { extensionManager } = imports.ui.main;
const Me = extensionUtils.getCurrentExtension(); const Me = extensionUtils.getCurrentExtension();
const { logDebug } = Me.imports.utils; const { logDebug } = Me.imports.utils;
const { Settings } = Me.imports.settings.Settings;
const { Timer } = Me.imports.modules.Timer; const { Timer } = Me.imports.modules.Timer;
const { GtkThemer } = Me.imports.modules.GtkThemer; const { GtkThemer } = Me.imports.modules.GtkThemer;
const { ShellThemer } = Me.imports.modules.ShellThemer; const { ShellThemer } = Me.imports.modules.ShellThemer;
@@ -21,7 +20,6 @@ const { Commander } = Me.imports.modules.Commander;
var enabled = false; var enabled = false;
var settings = null;
var timer = null; var timer = null;
var gtkThemer = null; var gtkThemer = null;
var shellThemer = null; var shellThemer = null;
@@ -53,7 +51,6 @@ function enable() {
*/ */
function start() { function start() {
logDebug('Enabling extension...'); logDebug('Enabling extension...');
settings = new Settings();
timer = new Timer(); timer = new Timer();
gtkThemer = new GtkThemer(); gtkThemer = new GtkThemer();
shellThemer = new ShellThemer(); shellThemer = new ShellThemer();
@@ -62,7 +59,6 @@ function start() {
backgrounder = new Backgrounder(); backgrounder = new Backgrounder();
commander = new Commander(); commander = new Commander();
settings.enable();
timer.enable(); timer.enable();
gtkThemer.enable(); gtkThemer.enable();
shellThemer.enable(); shellThemer.enable();
@@ -89,9 +85,7 @@ function disable() {
backgrounder.disable(); backgrounder.disable();
commander.disable(); commander.disable();
timer.disable(); timer.disable();
settings.disable();
settings = null;
timer = null; timer = null;
gtkThemer = null; gtkThemer = null;
shellThemer = null; shellThemer = null;
+55 -49
View File
@@ -1,12 +1,14 @@
// SPDX-FileCopyrightText: 2020, 2021 Romain Vigier <contact AT romainvigier.fr> // SPDX-FileCopyrightText: 2020, 2021 Romain Vigier <contact AT romainvigier.fr>
// SPDX-License-Identifier: GPL-3.0-or-later // SPDX-License-Identifier: GPL-3.0-or-later
const { Gio } = imports.gi;
const { extensionUtils } = imports.misc; const { extensionUtils } = imports.misc;
const Me = extensionUtils.getCurrentExtension(); const Me = extensionUtils.getCurrentExtension();
const e = Me.imports.extension; const e = Me.imports.extension;
const { logDebug } = Me.imports.utils; const utils = Me.imports.utils;
const { logDebug } = utils;
/** /**
* The Backgrounder is responsible for changing the desktop background * The Backgrounder is responsible for changing the desktop background
@@ -17,19 +19,20 @@ const { logDebug } = Me.imports.utils;
*/ */
var Backgrounder = class { var Backgrounder = class {
constructor() { constructor() {
this._statusChangedConnect = null; this._backgroundsSettings = extensionUtils.getSettings(utils.getSettingsSchema('backgrounds'));
this._backgroundChangedConnect = null; this._systemBackgroundSettings = new Gio.Settings({ schema: 'org.gnome.desktop.background' });
this._systemBackgroundChangedConnect = null; this._settingsConnections = [];
this._backgroundChangedConnect = null; this._statusConnection = null;
this._timerConnection = null;
} }
enable() { enable() {
logDebug('Enabling Backgrounder...'); logDebug('Enabling Backgrounder...');
this._watchStatus(); this._watchStatus();
if (e.settings.backgrounds.enabled) { if (this._backgroundsSettings.get_boolean('enabled')) {
this._connectSettings(); this._connectSettings();
this._connectTimer(); this._connectTimer();
this._changeSystemBackground(e.timer.time); this._updateSystemBackground(e.timer.time);
} }
logDebug('Backgrounder enabled.'); logDebug('Backgrounder enabled.');
} }
@@ -45,83 +48,86 @@ var Backgrounder = class {
_watchStatus() { _watchStatus() {
logDebug('Watching backgrounds status...'); logDebug('Watching backgrounds status...');
this._statusChangedConnect = e.settings.backgrounds.connect('status-changed', this._onStatusChanged.bind(this)); this._statusConnection = this._backgroundsSettings.connect('changed::enabled', this._onStatusChanged.bind(this));
} }
_unwatchStatus() { _unwatchStatus() {
if (this._statusChangedConnect) { if (this._statusConnection) {
e.settings.backgrounds.disconnect(this._statusChangedConnect); this._backgroundsSettings.disconnect(this._statusConnection);
this._statusChangedConnect = null; this._statusConnection = null;
} }
logDebug('Stopped watching backgrounds status.'); logDebug('Stopped watching backgrounds status.');
} }
_connectSettings() { _connectSettings() {
logDebug('Connecting Backgrounder to settings...'); logDebug('Connecting Backgrounder to settings...');
this._backgroundChangedConnect = e.settings.backgrounds.connect('background-changed', this._onBackgroundChanged.bind(this)); this._settingsConnections.push({
this._systemBackgroundChangedConnect = e.settings.system.connect('background-changed', this._onSystemBackgroundChanged.bind(this)); settings: this._backgroundsSettings,
id: this._backgroundsSettings.connect('changed::day', this._onDayBackgroundChanged.bind(this)),
});
this._settingsConnections.push({
settings: this._backgroundsSettings,
id: this._backgroundsSettings.connect('changed::night', this._onNightBackgroundChanged.bind(this)),
});
this._settingsConnections.push({
settings: this._systemBackgroundSettings,
id: this._systemBackgroundSettings.connect('changed::picture-uri', this._onSystemBackgroundChanged.bind(this)),
});
} }
_disconnectSettings() { _disconnectSettings() {
if (this._backgroundChangedConnect) { this._settingsConnections.forEach(connection => connection.settings.disconnect(connection.id));
e.settings.backgrounds.disconnect(this._backgroundChangedConnect); this._settingsConnections = [];
this._backgroundChangedConnect = null;
}
if (this._systemBackgroundChangedConnect) {
e.settings.system.disconnect(this._systemBackgroundChangedConnect);
this._systemBackgroundChangedConnect = null;
}
logDebug('Disconnected Backgrounder from settings.'); logDebug('Disconnected Backgrounder from settings.');
} }
_connectTimer() { _connectTimer() {
logDebug('Connecting Backgrounder to Timer...'); logDebug('Connecting Backgrounder to Timer...');
this._backgroundChangedConnect = e.timer.connect('time-changed', this._onTimeChanged.bind(this)); this._timerConnection = e.timer.connect('time-changed', this._onTimeChanged.bind(this));
} }
_disconnectTimer() { _disconnectTimer() {
if (this._backgroundChangedConnect) { if (this._timerConnection) {
e.timer.disconnect(this._backgroundChangedConnect); e.timer.disconnect(this._timerConnection);
this._backgroundChangedConnect = null; this._timerConnection = null;
} }
logDebug('Disconnected Backgrounder from Timer.'); logDebug('Disconnected Backgrounder from Timer.');
} }
_onStatusChanged(_settings, _enabled) { _onStatusChanged() {
logDebug(`Backgrounds switching has been ${this._backgroundsSettings.get_boolean('enabled') ? 'enabled' : 'disabled'}.`);
this.disable(); this.disable();
this.enable(); this.enable();
} }
_onBackgroundChanged(_settings, changedBackgroundTime) { _onDayBackgroundChanged() {
if (changedBackgroundTime === e.timer.time) logDebug(`Day background changed to '${this._backgroundsSettings.get_string('day')}'.`);
this._changeSystemBackground(changedBackgroundTime); this._updateSystemBackground();
} }
_onSystemBackgroundChanged(_settings, newBackground) { _onNightBackgroundChanged() {
switch (e.timer.time) { logDebug(`Night background changed to '${this._backgroundsSettings.get_string('night')}'.`);
case 'day': this._updateSystemBackground();
e.settings.backgrounds.day = newBackground;
break;
case 'night':
e.settings.backgrounds.night = newBackground;
}
} }
_onTimeChanged(_timer, newTime) { _onSystemBackgroundChanged() {
this._changeSystemBackground(newTime); logDebug(`System background changed to '${this._systemBackgroundSettings.get_string('picture-uri')}'.`);
this._updateCurrentBackground();
}
_onTimeChanged() {
this._updateSystemBackground();
} }
_changeSystemBackground(time) { _updateCurrentBackground() {
switch (time) { if (e.timer.time)
case 'day': this._backgroundsSettings.set_string(e.timer.time, this._systemBackgroundSettings.get_string('picture-uri'));
if (e.settings.backgrounds.day) }
e.settings.system.background = e.settings.backgrounds.day;
break; _updateSystemBackground() {
case 'night': if (e.timer.time && this._backgroundsSettings.get_string(e.timer.time))
if (e.settings.backgrounds.night) this._systemBackgroundSettings.set_string('picture-uri', this._backgroundsSettings.get_string(e.timer.time));
e.settings.system.background = e.settings.backgrounds.night;
}
} }
}; };
+23 -18
View File
@@ -7,7 +7,8 @@ const { extensionUtils } = imports.misc;
const Me = extensionUtils.getCurrentExtension(); const Me = extensionUtils.getCurrentExtension();
const e = Me.imports.extension; const e = Me.imports.extension;
const { logDebug } = Me.imports.utils; const utils = Me.imports.utils;
const { logDebug } = utils;
/** /**
@@ -15,14 +16,15 @@ const { logDebug } = Me.imports.utils;
*/ */
var Commander = class { var Commander = class {
constructor() { constructor() {
this._statusChangedConnect = null; this._commandsSettings = extensionUtils.getSettings(utils.getSettingsSchema('commands'));
this._timeChangedConnect = null; this._statusConnection = null;
this._timerConnection = null;
} }
enable() { enable() {
logDebug('Enabling Commander...'); logDebug('Enabling Commander...');
this._watchStatus(); this._watchStatus();
if (e.settings.commands.enabled) { if (this._commandsSettings.get_boolean('enabled')) {
this._connectTimer(); this._connectTimer();
this._spawnCommand(e.timer.time); this._spawnCommand(e.timer.time);
} }
@@ -39,44 +41,47 @@ var Commander = class {
_watchStatus() { _watchStatus() {
logDebug('Watching commands status...'); logDebug('Watching commands status...');
this._statusChangedConnect = e.settings.commands.connect('status-changed', this._onStatusChanged.bind(this)); this._statusConnection = this._commandsSettings.connect('changed::enabled', this._onStatusChanged.bind(this));
} }
_unwatchStatus() { _unwatchStatus() {
if (this._statusChangedConnect) { if (this._statusConnection) {
e.settings.commands.disconnect(this._statusChangedConnect); this._commandsSettings.disconnect(this._statusConnection);
this._statusChangedConnect = null; this._statusConnection = null;
} }
logDebug('Stopped watching commands status.'); logDebug('Stopped watching commands status.');
} }
_connectTimer() { _connectTimer() {
logDebug('Connecting Commander to Timer...'); logDebug('Connecting Commander to Timer...');
this._timeChangedConnect = e.timer.connect('time-changed', this._onTimeChanged.bind(this)); this._timerConnection = e.timer.connect('time-changed', this._onTimeChanged.bind(this));
} }
_disconnectTimer() { _disconnectTimer() {
if (this._timeChangedConnect) { if (this._timerConnection) {
e.timer.disconnect(this._timeChangedConnect); e.timer.disconnect(this._timerConnection);
this._timeChangedConnect = null; this._timerConnection = null;
} }
logDebug('Disconnecting Commander from Timer.'); logDebug('Disconnecting Commander from Timer.');
} }
_onStatusChanged(_settings, _enabled) { _onStatusChanged() {
logDebug(`Commands launching has been ${this._commandsSettings.get_boolean('enabled') ? 'enabled' : 'disabled'}.`);
this.disable(); this.disable();
this.enable(); this.enable();
} }
_onTimeChanged(_timer, newTime) { _onTimeChanged() {
this._spawnCommand(newTime); this._spawnCommand();
} }
_spawnCommand(time) { _spawnCommand() {
const command = time === 'day' ? e.settings.commands.sunrise : e.settings.commands.sunset; if (!e.timer.time)
return;
const command = this._commandsSettings.get_string(e.timer.time === 'day' ? 'sunrise' : 'sunset');
GLib.spawn_async(null, ['sh', '-c', command], null, GLib.SpawnFlags.SEARCH_PATH, null); GLib.spawn_async(null, ['sh', '-c', command], null, GLib.SpawnFlags.SEARCH_PATH, null);
logDebug(`Spawned ${time} command.`); logDebug(`Spawned ${e.timer.time} command.`);
} }
}; };
+55 -51
View File
@@ -1,13 +1,15 @@
// SPDX-FileCopyrightText: 2020, 2021 Romain Vigier <contact AT romainvigier.fr> // SPDX-FileCopyrightText: 2020, 2021 Romain Vigier <contact AT romainvigier.fr>
// SPDX-License-Identifier: GPL-3.0-or-later // SPDX-License-Identifier: GPL-3.0-or-later
const { Gio } = imports.gi;
const { extensionUtils } = imports.misc; const { extensionUtils } = imports.misc;
const { main } = imports.ui; const { main } = imports.ui;
const Me = extensionUtils.getCurrentExtension(); const Me = extensionUtils.getCurrentExtension();
const e = Me.imports.extension; const e = Me.imports.extension;
const { logDebug } = Me.imports.utils; const utils = Me.imports.utils;
const { logDebug } = utils;
/** /**
@@ -16,19 +18,20 @@ const { logDebug } = Me.imports.utils;
*/ */
var CursorThemer = class { var CursorThemer = class {
constructor() { constructor() {
this._statusChangedConnect = null; this._cursorVariantsSettings = extensionUtils.getSettings(utils.getSettingsSchema('cursor-variants'));
this._variantChangedConnect = null; this._interfaceSettings = new Gio.Settings({ schema: 'org.gnome.desktop.interface' });
this._systemCursorThemeChangedConnect = null; this._settingsConnections = [];
this._timeChangedConnect = null; this._statusConnection = null;
this._timerConnection = null;
} }
enable() { enable() {
logDebug('Enabling Cursor Themer...'); logDebug('Enabling Cursor Themer...');
this._watchStatus(); this._watchStatus();
if (e.settings.cursorVariants.enabled) { if (this._cursorVariantsSettings.get_boolean('enabled')) {
this._connectSettings(); this._connectSettings();
this._connectTimer(); this._connectTimer();
this._setSystemVariant(e.timer.time); this._updateSystemCursorTheme();
} }
logDebug('Cursor Themer enabled.'); logDebug('Cursor Themer enabled.');
} }
@@ -44,85 +47,86 @@ var CursorThemer = class {
_watchStatus() { _watchStatus() {
logDebug('Watching cursor variants status...'); logDebug('Watching cursor variants status...');
this._statusChangedConnect = e.settings.cursorVariants.connect('status-changed', this._onStatusChanged.bind(this)); this._statusConnection = this._cursorVariantsSettings.connect('changed::enabled', this._onStatusChanged.bind(this));
} }
_unwatchStatus() { _unwatchStatus() {
if (this._statusChangedConnect) { if (this._statusConnection) {
e.settings.cursorVariants.disconnect(this._statusChangedConnect); this._cursorVariantsSettings.disconnect(this._statusConnection);
this._statusChangedConnect = null; this._statusConnection = null;
} }
logDebug('Stopped watching cursor variants status.'); logDebug('Stopped watching cursor variants status.');
} }
_connectSettings() { _connectSettings() {
logDebug('Connecting Cursor Themer to settings...'); logDebug('Connecting Cursor Themer to settings...');
this._variantChangedConnect = e.settings.cursorVariants.connect('variant-changed', this._onVariantChanged.bind(this)); this._settingsConnections.push({
this._systemCursorThemeChangedConnect = e.settings.system.connect('cursor-theme-changed', this._onSystemCursorThemeChanged.bind(this)); settings: this._cursorVariantsSettings,
id: this._cursorVariantsSettings.connect('changed::day', this._onDayVariantChanged.bind(this)),
});
this._settingsConnections.push({
settings: this._cursorVariantsSettings,
id: this._cursorVariantsSettings.connect('changed::night', this._onNightVariantChanged.bind(this)),
});
this._settingsConnections.push({
settings: this._interfaceSettings,
id: this._interfaceSettings.connect('changed::cursor-theme', this._onSystemCursorThemeChanged.bind(this)),
});
} }
_disconnectSettings() { _disconnectSettings() {
if (this._variantChangedConnect) { this._settingsConnections.forEach(connection => connection.settings.disconnect(connection.id));
e.settings.cursorVariants.disconnect(this._variantChangedConnect); this._settingsConnections = [];
this._variantChangedConnect = null;
}
if (this._systemCursorThemeChangedConnect) {
e.settings.system.disconnect(this._systemCursorThemeChangedConnect);
this._systemCursorThemeChangedConnect = null;
}
logDebug('Disconnected Cursor Themer from settings.'); logDebug('Disconnected Cursor Themer from settings.');
} }
_connectTimer() { _connectTimer() {
logDebug('Connecting Cursor Themer to Timer...'); logDebug('Connecting Cursor Themer to Timer...');
this._timeChangedConnect = e.timer.connect('time-changed', this._onTimeChanged.bind(this)); this._timerConnection = e.timer.connect('time-changed', this._onTimeChanged.bind(this));
} }
_disconnectTimer() { _disconnectTimer() {
if (this._timeChangedConnect) { if (this._timerConnection) {
e.timer.disconnect(this._timeChangedConnect); e.timer.disconnect(this._timerConnection);
this._timeChangedConnect = null; this._timerConnection = null;
} }
logDebug('Disconnected Cursor Themer from Timer.'); logDebug('Disconnected Cursor Themer from Timer.');
} }
_onStatusChanged(_settings, _enabled) { _onStatusChanged() {
logDebug(`Cursor variants switching has been ${this._cursorVariantsSettings.get_boolean('enabled') ? 'enabled' : 'disabled'}.`);
this.disable(); this.disable();
this.enable(); this.enable();
} }
_onVariantChanged(_settings, changedVariantTime) { _onDayVariantChanged() {
if (changedVariantTime === e.timer.time) logDebug(`Day cursor variant changed to '${this._cursorVariantsSettings.get_string('day')}'.`);
this._setSystemVariant(changedVariantTime); this._updateSystemCursorTheme();
} }
_onSystemCursorThemeChanged(_settings, newTheme) { _onNightVariantChanged() {
switch (e.timer.time) { logDebug(`Night cursor variant changed to '${this._cursorVariantsSettings.get_string('night')}'.`);
case 'day': this._updateSystemCursorTheme();
e.settings.cursorVariants.day = newTheme;
break;
case 'night':
e.settings.cursorVariants.night = newTheme;
}
this._setSystemVariant(e.timer.time);
} }
_onTimeChanged(_timer, newTime) { _onSystemCursorThemeChanged() {
this._setSystemVariant(newTime); logDebug(`System cursor theme changed to '${this._interfaceSettings.get_string('cursor-theme')}'.`);
this._updateCurrentVariant();
}
_onTimeChanged() {
this._updateSystemCursorTheme();
} }
_setSystemVariant(time) { _updateCurrentVariant() {
logDebug(`Setting the cursor ${time} variant...`); if (e.timer.time)
switch (time) { this._cursorVariantsSettings.set_string(e.timer.time, this._interfaceSettings.get_string('cursor-theme'));
case 'day': }
if (e.settings.cursorVariants.day)
e.settings.system.cursorTheme = e.settings.cursorVariants.day; _updateSystemCursorTheme() {
break; if (e.timer.time && this._cursorVariantsSettings.get_string(e.timer.time))
case 'night': this._interfaceSettings.set_string('cursor-theme', this._cursorVariantsSettings.get_string(e.timer.time));
if (e.settings.cursorVariants.night)
e.settings.system.cursorTheme = e.settings.cursorVariants.night;
}
} }
}; };
+72 -50
View File
@@ -1,13 +1,15 @@
// SPDX-FileCopyrightText: 2020, 2021 Romain Vigier <contact AT romainvigier.fr> // SPDX-FileCopyrightText: 2020, 2021 Romain Vigier <contact AT romainvigier.fr>
// SPDX-License-Identifier: GPL-3.0-or-later // SPDX-License-Identifier: GPL-3.0-or-later
const { Gio } = imports.gi;
const { extensionUtils } = imports.misc; const { extensionUtils } = imports.misc;
const { main } = imports.ui; const { main } = imports.ui;
const Me = extensionUtils.getCurrentExtension(); const Me = extensionUtils.getCurrentExtension();
const e = Me.imports.extension; const e = Me.imports.extension;
const { logDebug, notifyError, getInstalledGtkThemes } = Me.imports.utils; const utils = Me.imports.utils;
const { logDebug, notifyError } = utils;
const { GtkVariants } = Me.imports.modules.GtkVariants; const { GtkVariants } = Me.imports.modules.GtkVariants;
const Gettext = imports.gettext.domain(Me.metadata['gettext-domain']); const Gettext = imports.gettext.domain(Me.metadata['gettext-domain']);
@@ -27,22 +29,22 @@ const _ = Gettext.gettext;
*/ */
var GtkThemer = class { var GtkThemer = class {
constructor() { constructor() {
this._statusChangedConnect = null; this._gtkVariantsSettings = extensionUtils.getSettings(utils.getSettingsSchema('gtk-variants'));
this._variantChangedConnect = null; this._interfaceSettings = new Gio.Settings({ schema: 'org.gnome.desktop.interface' });
this._manualChangedConnect = null; this._settingsConnections = [];
this._systemGtkThemeChangedConnect = null; this._statusConnection = null;
this._timeChangedConnect = null; this._timerConnection = null;
} }
enable() { enable() {
logDebug('Enabling GTK Themer...'); logDebug('Enabling GTK Themer...');
try { try {
this._watchStatus(); this._watchStatus();
if (e.settings.gtkVariants.enabled) { if (this._gtkVariantsSettings.get_boolean('enabled')) {
this._connectSettings(); this._connectSettings();
this._updateVariants(); this._updateVariants();
this._connectTimer(); this._connectTimer();
this._setSystemVariant(e.timer.time); this._updateSystemGtkTheme();
} }
} catch (error) { } catch (error) {
notifyError(error); notifyError(error);
@@ -61,110 +63,130 @@ var GtkThemer = class {
_watchStatus() { _watchStatus() {
logDebug('Watching GTK variants status...'); logDebug('Watching GTK variants status...');
this._statusChangedConnect = e.settings.gtkVariants.connect('status-changed', this._onStatusChanged.bind(this)); this._statusConnection = this._gtkVariantsSettings.connect('changed::enabled', this._onStatusChanged.bind(this));
} }
_unwatchStatus() { _unwatchStatus() {
if (this._statusChangedConnect) { if (this._statusConnection) {
e.settings.gtkVariants.disconnect(this._statusChangedConnect); this._gtkVariantsSettings.disconnect(this._statusConnection);
this._statusChangedConnect = null; this._statusConnection = null;
} }
logDebug('Stopped watching GTK variants status.'); logDebug('Stopped watching GTK variants status.');
} }
_connectSettings() { _connectSettings() {
logDebug('Connecting GTK Themer to settings...'); logDebug('Connecting GTK Themer to settings...');
this._variantChangedConnect = e.settings.gtkVariants.connect('variant-changed', this._onVariantChanged.bind(this)); this._settingsConnections.push({
this._manualChangedConnect = e.settings.gtkVariants.connect('manual-changed', this._onManualChanged.bind(this)); settings: this._gtkVariantsSettings,
this._systemGtkThemeChangedConnect = e.settings.system.connect('gtk-theme-changed', this._onSystemGtkThemeChanged.bind(this)); id: this._gtkVariantsSettings.connect('changed::day', this._onDayVariantChanged.bind(this)),
});
this._settingsConnections.push({
settings: this._gtkVariantsSettings,
id: this._gtkVariantsSettings.connect('changed::night', this._onNightVariantChanged.bind(this)),
});
this._settingsConnections.push({
settings: this._gtkVariantsSettings,
id: this._gtkVariantsSettings.connect('changed::manual', this._onManualChanged.bind(this)),
});
this._settingsConnections.push({
settings: this._interfaceSettings,
id: this._interfaceSettings.connect('changed::gtk-theme', this._onSystemGtkThemeChanged.bind(this)),
});
} }
_disconnectSettings() { _disconnectSettings() {
if (this._variantChangedConnect) { this._settingsConnections.forEach(connection => connection.settings.disconnect(connection.id));
e.settings.gtkVariants.disconnect(this._variantChangedConnect); this._settingsConnections = [];
this._variantChangedConnect = null;
}
if (this._manualChangedConnect) {
e.settings.gtkVariants.disconnect(this._manualChangedConnect);
this._manualChangedConnect = null;
}
if (this._systemGtkThemeChangedConnect) {
e.settings.system.disconnect(this._systemGtkThemeChangedConnect);
this._systemGtkThemeChangedConnect = null;
}
logDebug('Disconnected GTK Themer from settings.'); logDebug('Disconnected GTK Themer from settings.');
} }
_connectTimer() { _connectTimer() {
logDebug('Connecting GTK Themer to Timer...'); logDebug('Connecting GTK Themer to Timer...');
this._timeChangedConnect = e.timer.connect('time-changed', this._onTimeChanged.bind(this)); this._timerConnection = e.timer.connect('time-changed', this._onTimeChanged.bind(this));
} }
_disconnectTimer() { _disconnectTimer() {
if (this._timeChangedConnect) { if (this._timerConnection) {
e.timer.disconnect(this._timeChangedConnect); e.timer.disconnect(this._timerConnection);
this._timeChangedConnect = null; this._timerConnection = null;
} }
logDebug('Disconnected GTK Themer from Timer.'); logDebug('Disconnected GTK Themer from Timer.');
} }
_onStatusChanged(_settings, _enabled) { _onStatusChanged() {
logDebug(`GTK variants switching has been ${this._gtkVariantsSettings.get_boolean('enabled') ? 'enabled' : 'disabled'}.`);
this.disable(); this.disable();
this.enable(); this.enable();
} }
_onVariantChanged(_settings, changedVariantTime) { _onDayVariantChanged() {
if (changedVariantTime === e.timer.time) logDebug(`Day GTK variant changed to '${this._gtkVariantsSettings.get_string('day')}'.`);
this._setSystemVariant(changedVariantTime); this._updateSystemGtkTheme();
} }
_onSystemGtkThemeChanged(_settings, _newTheme) { _onNightVariantChanged() {
logDebug(`Night GTK variant changed to '${this._gtkVariantsSettings.get_string('night')}'.`);
this._updateSystemGtkTheme();
}
_onSystemGtkThemeChanged() {
logDebug(`System GTK theme changed to '${this._interfaceSettings.get_string('gtk-theme')}'.`);
try { try {
this._updateVariants(); this._updateVariants();
this._setSystemVariant(e.timer.time); this._updateCurrentVariant();
this._updateSystemGtkTheme();
} catch (error) { } catch (error) {
notifyError(error); notifyError(error);
} }
} }
_onManualChanged(_settings, _enabled) { _onManualChanged() {
logDebug(`Manual GTK variants choice has been ${this._gtkVariantsSettings.get_boolean('manual') ? 'enabled' : 'disabled'}.`);
this.disable(); this.disable();
this.enable(); this.enable();
} }
_onTimeChanged(_timer, newTime) { _onTimeChanged() {
this._setSystemVariant(newTime); this._updateSystemGtkTheme();
} }
_areVariantsUpToDate() { _areVariantsUpToDate() {
return e.settings.system.gtkTheme === e.settings.gtkVariants.day || e.settings.system.gtkTheme === e.settings.gtkVariants.night; return (
this._interfaceSettings.get_string('gtk-theme') === this._gtkVariantsSettings.get_string('day') ||
this._interfaceSettings.get_string('gtk-theme') === this._gtkVariantsSettings.get_string('night')
);
} }
_setSystemVariant(time) { _updateCurrentVariant() {
if (!time) if (this._gtkVariantsSettings.get_boolean('manual') && e.timer.time)
this._gtkVariantsSettings.set_string(e.timer.time, this._interfaceSettings.get_string('gtk-theme'));
}
_updateSystemGtkTheme() {
if (!e.timer.time)
return; return;
logDebug(`Setting the GTK ${time} variant...`); logDebug(`Setting the ${e.timer.time} GTK variant...`);
e.settings.system.gtkTheme = time === 'day' ? e.settings.gtkVariants.day : e.settings.gtkVariants.night; this._interfaceSettings.set_string('gtk-theme', this._gtkVariantsSettings.get_string(e.timer.time));
} }
_updateVariants() { _updateVariants() {
if (e.settings.gtkVariants.manual || this._areVariantsUpToDate()) if (this._gtkVariantsSettings.get_boolean('manual') || this._areVariantsUpToDate())
return; return;
logDebug('Updating GTK variants...'); logDebug('Updating GTK variants...');
const originalTheme = e.settings.system.gtkTheme; const originalTheme = this._interfaceSettings.get_string('gtk-theme');
const variants = GtkVariants.guessFrom(originalTheme); const variants = GtkVariants.guessFrom(originalTheme);
const installedThemes = getInstalledGtkThemes(); const installedThemes = utils.getInstalledGtkThemes();
if (!installedThemes.has(variants.get('day')) || !installedThemes.has(variants.get('night'))) { if (!installedThemes.has(variants.get('day')) || !installedThemes.has(variants.get('night'))) {
const message = _('Unable to automatically detect the day and night variants for the "%s" GTK theme. Please manually choose them in the extension\'s preferences.').format(originalTheme); const message = _('Unable to automatically detect the day and night variants for the "%s" GTK theme. Please manually choose them in the extension\'s preferences.').format(originalTheme);
throw new Error(message); throw new Error(message);
} }
e.settings.gtkVariants.day = variants.get('day'); this._gtkVariantsSettings.set_string('day', variants.get('day'));
e.settings.gtkVariants.night = variants.get('night'); this._gtkVariantsSettings.set_string('night', variants.get('night'));
logDebug(`New GTK variants. { day: '${variants.get('day')}'; night: '${variants.get('night')}' }`); logDebug(`New GTK variants. { day: '${variants.get('day')}'; night: '${variants.get('night')}' }`);
} }
}; };
+55 -51
View File
@@ -1,13 +1,15 @@
// SPDX-FileCopyrightText: 2020, 2021 Romain Vigier <contact AT romainvigier.fr> // SPDX-FileCopyrightText: 2020, 2021 Romain Vigier <contact AT romainvigier.fr>
// SPDX-License-Identifier: GPL-3.0-or-later // SPDX-License-Identifier: GPL-3.0-or-later
const { Gio } = imports.gi;
const { extensionUtils } = imports.misc; const { extensionUtils } = imports.misc;
const { main } = imports.ui; const { main } = imports.ui;
const Me = extensionUtils.getCurrentExtension(); const Me = extensionUtils.getCurrentExtension();
const e = Me.imports.extension; const e = Me.imports.extension;
const { logDebug } = Me.imports.utils; const utils = Me.imports.utils;
const { logDebug } = utils;
/** /**
@@ -16,19 +18,20 @@ const { logDebug } = Me.imports.utils;
*/ */
var IconThemer = class { var IconThemer = class {
constructor() { constructor() {
this._statusChangedConnect = null; this._iconVariantsSettings = extensionUtils.getSettings(utils.getSettingsSchema('icon-variants'));
this._variantChangedConnect = null; this._interfaceSettings = new Gio.Settings({ schema: 'org.gnome.desktop.interface' });
this._systemIconThemeChangedConnect = null; this._settingsConnections = [];
this._timeChangedConnect = null; this._statusConnection = null;
this._timerConnection = null;
} }
enable() { enable() {
logDebug('Enabling Icon Themer...'); logDebug('Enabling Icon Themer...');
this._watchStatus(); this._watchStatus();
if (e.settings.iconVariants.enabled) { if (this._iconVariantsSettings.get_boolean('enabled')) {
this._connectSettings(); this._connectSettings();
this._connectTimer(); this._connectTimer();
this._setSystemVariant(e.timer.time); this._updateSystemIconTheme();
} }
logDebug('Icon Themer enabled.'); logDebug('Icon Themer enabled.');
} }
@@ -44,85 +47,86 @@ var IconThemer = class {
_watchStatus() { _watchStatus() {
logDebug('Watching icon variants status...'); logDebug('Watching icon variants status...');
this._statusChangedConnect = e.settings.iconVariants.connect('status-changed', this._onStatusChanged.bind(this)); this._statusConnection = this._iconVariantsSettings.connect('changed::enabled', this._onStatusChanged.bind(this));
} }
_unwatchStatus() { _unwatchStatus() {
if (this._statusChangedConnect) { if (this._statusConnection) {
e.settings.iconVariants.disconnect(this._statusChangedConnect); this._iconVariantsSettings.disconnect(this._statusConnection);
this._statusChangedConnect = null; this._statusConnection = null;
} }
logDebug('Stopped watching icon variants status.'); logDebug('Stopped watching icon variants status.');
} }
_connectSettings() { _connectSettings() {
logDebug('Connecting Icon Themer to settings...'); logDebug('Connecting Icon Themer to settings...');
this._variantChangedConnect = e.settings.iconVariants.connect('variant-changed', this._onVariantChanged.bind(this)); this._settingsConnections.push({
this._systemIconThemeChangedConnect = e.settings.system.connect('icon-theme-changed', this._onSystemIconThemeChanged.bind(this)); settings: this._iconVariantsSettings,
id: this._iconVariantsSettings.connect('changed::day', this._onDayVariantChanged.bind(this)),
});
this._settingsConnections.push({
settings: this._iconVariantsSettings,
id: this._iconVariantsSettings.connect('changed::night', this._onNightVariantChanged.bind(this)),
});
this._settingsConnections.push({
settings: this._interfaceSettings,
id: this._interfaceSettings.connect('changed::icon-theme', this._onSystemIconThemeChanged.bind(this)),
});
} }
_disconnectSettings() { _disconnectSettings() {
if (this._variantChangedConnect) { this._settingsConnections.forEach(connection => connection.settings.disconnect(connection.id));
e.settings.iconVariants.disconnect(this._variantChangedConnect); this._settingsConnections = [];
this._variantChangedConnect = null;
}
if (this._systemIconThemeChangedConnect) {
e.settings.system.disconnect(this._systemIconThemeChangedConnect);
this._systemIconThemeChangedConnect = null;
}
logDebug('Disconnected Icon Themer from settings.'); logDebug('Disconnected Icon Themer from settings.');
} }
_connectTimer() { _connectTimer() {
logDebug('Connecting Icon Themer to Timer...'); logDebug('Connecting Icon Themer to Timer...');
this._timeChangedConnect = e.timer.connect('time-changed', this._onTimeChanged.bind(this)); this._timerConnection = e.timer.connect('time-changed', this._onTimeChanged.bind(this));
} }
_disconnectTimer() { _disconnectTimer() {
if (this._timeChangedConnect) { if (this._timerConnection) {
e.timer.disconnect(this._timeChangedConnect); e.timer.disconnect(this._timerConnection);
this._timeChangedConnect = null; this._timerConnection = null;
} }
logDebug('Disconnected Icon Themer from Timer.'); logDebug('Disconnected Icon Themer from Timer.');
} }
_onStatusChanged(_settings, _enabled) { _onStatusChanged() {
logDebug(`Icon variants switching has been ${this._iconVariantsSettings.get_boolean('enabled') ? 'enabled' : 'disabled'}.`);
this.disable(); this.disable();
this.enable(); this.enable();
} }
_onVariantChanged(_settings, changedVariantTime) { _onDayVariantChanged() {
if (changedVariantTime === e.timer.time) logDebug(`Day icon variant changed to '${this._iconVariantsSettings.get_string('day')}'.`);
this._setSystemVariant(changedVariantTime); this._updateSystemIconTheme();
} }
_onSystemIconThemeChanged(_settings, newTheme) { _onNightVariantChanged() {
switch (e.timer.time) { logDebug(`Night icon variant changed to '${this._iconVariantsSettings.get_string('night')}'.`);
case 'day': this._updateSystemIconTheme();
e.settings.iconVariants.day = newTheme;
break;
case 'night':
e.settings.iconVariants.night = newTheme;
}
this._setSystemVariant(e.timer.time);
} }
_onTimeChanged(_timer, newTime) { _onSystemIconThemeChanged() {
this._setSystemVariant(newTime); logDebug(`System icon theme changed to '${this._iconVariantsSettings.get_string('icon-theme')}'.`);
this._updateCurrentVariant();
}
_onTimeChanged() {
this._updateSystemIconTheme();
} }
_setSystemVariant(time) { _updateCurrentVariant() {
logDebug(`Setting the icon ${time} variant...`); if (e.timer.time)
switch (time) { this._iconVariantsSettings.set_string(e.timer.time, this._interfaceSettings.get_string('icon-theme'));
case 'day': }
if (e.settings.iconVariants.day)
e.settings.system.iconTheme = e.settings.iconVariants.day; _updateSystemIconTheme() {
break; if (e.timer.time && this._iconVariantsSettings.get_string(e.timer.time))
case 'night': this._interfaceSettings.set_string('icon-theme', this._iconVariantsSettings.get_string(e.timer.time));
if (e.settings.iconVariants.night)
e.settings.system.iconTheme = e.settings.iconVariants.night;
}
} }
}; };
+81 -54
View File
@@ -1,6 +1,7 @@
// SPDX-FileCopyrightText: 2020, 2021 Romain Vigier <contact AT romainvigier.fr> // SPDX-FileCopyrightText: 2020, 2021 Romain Vigier <contact AT romainvigier.fr>
// SPDX-License-Identifier: GPL-3.0-or-later // SPDX-License-Identifier: GPL-3.0-or-later
const { Gio } = imports.gi;
const { extensionUtils } = imports.misc; const { extensionUtils } = imports.misc;
const Signals = imports.signals; const Signals = imports.signals;
const { main } = imports.ui; const { main } = imports.ui;
@@ -8,7 +9,8 @@ const { main } = imports.ui;
const Me = extensionUtils.getCurrentExtension(); const Me = extensionUtils.getCurrentExtension();
const e = Me.imports.extension; const e = Me.imports.extension;
const { logDebug, notifyError, getInstalledShellThemes, getShellThemeStylesheet, applyShellStylesheet } = Me.imports.utils; const utils = Me.imports.utils;
const { logDebug, notifyError } = Me.imports.utils;
const { ShellVariants } = Me.imports.modules.ShellVariants; const { ShellVariants } = Me.imports.modules.ShellVariants;
const Gettext = imports.gettext.domain(Me.metadata['gettext-domain']); const Gettext = imports.gettext.domain(Me.metadata['gettext-domain']);
@@ -27,22 +29,22 @@ const _ = Gettext.gettext;
*/ */
var ShellThemer = class { var ShellThemer = class {
constructor() { constructor() {
this._statusChangedConnect = null; this._shellVariantsSettings = extensionUtils.getSettings(utils.getSettingsSchema('shell-variants'));
this._variantChangedConnect = null; this._userthemesSettings = utils.getUserthemesSettings();
this._manualChangedConnect = null; this._settingsConnections = [];
this._systemShellThemeChangedConnect = null; this._statusConnection = null;
this._timeChangedConnect = null; this._timerConnection = null;
} }
enable() { enable() {
logDebug('Enabling Shell Themer...'); logDebug('Enabling Shell Themer...');
try { try {
this._watchStatus(); this._watchStatus();
if (e.settings.shellVariants.enabled) { if (this._shellVariantsSettings.get_boolean('enabled')) {
this._connectSettings(); this._connectSettings();
this._updateVariants(); this._updateVariants();
this._connectTimer(); this._connectTimer();
this._setSystemVariant(e.timer.time); this._updateSystemShellTheme();
} }
} catch (error) { } catch (error) {
notifyError(error); notifyError(error);
@@ -61,117 +63,142 @@ var ShellThemer = class {
_watchStatus() { _watchStatus() {
logDebug('Watching shell variants status...'); logDebug('Watching shell variants status...');
this._statusChangedConnect = e.settings.shellVariants.connect('status-changed', this._onStatusChanged.bind(this)); this._statusConnection = this._shellVariantsSettings.connect('changed::enabled', this._onStatusChanged.bind(this));
} }
_unwatchStatus() { _unwatchStatus() {
if (this._statusChangedConnect) { if (this._statusConnection) {
e.settings.shellVariants.disconnect(this._statusChangedConnect); this._shellVariantsSettings.disconnect(this._statusConnection);
this._statusChangedConnect = null; this._statusConnection = null;
} }
logDebug('Stopped watching shell variants status.'); logDebug('Stopped watching shell variants status.');
} }
_connectSettings() { _connectSettings() {
logDebug('Connecting Shell Themer to settings...'); logDebug('Connecting Shell Themer to settings...');
this._variantChangedConnect = e.settings.shellVariants.connect('variant-changed', this._onVariantChanged.bind(this)); this._settingsConnections.push({
this._manualChangedConnect = e.settings.shellVariants.connect('manual-changed', this._onManualChanged.bind(this)); settings: this._shellVariantsSettings,
this._systemShellThemeChangedConnect = e.settings.system.connect('shell-theme-changed', this._onSystemShellThemeChanged.bind(this)); id: this._shellVariantsSettings.connect('changed::day', this._onDayVariantChanged.bind(this)),
});
this._settingsConnections.push({
settings: this._shellVariantsSettings,
id: this._shellVariantsSettings.connect('changed::night', this._onNightVariantChanged.bind(this)),
});
this._settingsConnections.push({
settings: this._shellVariantsSettings,
id: this._shellVariantsSettings.connect('changed::manual', this._onManualChanged.bind(this)),
});
if (this._userthemesSettings) {
this._settingsConnections.push({
settings: this._userthemesSettings,
id: this._userthemesSettings.connect('changed::name', this._onSystemShellThemeChanged.bind(this)),
});
}
} }
_disconnectSettings() { _disconnectSettings() {
if (this._variantChangedConnect) { this._settingsConnections.forEach(connection => connection.settings.disconnect(connection.id));
e.settings.shellVariants.disconnect(this._variantChangedConnect); this._settingsConnections = [];
this._variantChangedConnect = null;
}
if (this._manualChangedConnect) {
e.settings.shellVariants.disconnect(this._manualChangedConnect);
this._manualChangedConnect = null;
}
if (this._systemShellThemeChangedConnect) {
e.settings.system.disconnect(this._systemShellThemeChangedConnect);
this._systemShellThemeChangedConnect = null;
}
logDebug('Disconnected Shell Themer from settings.'); logDebug('Disconnected Shell Themer from settings.');
} }
_connectTimer() { _connectTimer() {
logDebug('Connecting Shell Themer to Timer...'); logDebug('Connecting Shell Themer to Timer...');
this._timeChangedConnect = e.timer.connect('time-changed', this._onTimeChanged.bind(this)); this._timerConnection = e.timer.connect('time-changed', this._onTimeChanged.bind(this));
} }
_disconnectTimer() { _disconnectTimer() {
if (this._timeChangedConnect) { if (this._timerConnection) {
e.timer.disconnect(this._timeChangedConnect); e.timer.disconnect(this._timerConnection);
this._timeChangedConnect = null; this._timerConnection = null;
} }
logDebug('Disconnected Shell Themer from Timer.'); logDebug('Disconnected Shell Themer from Timer.');
} }
_onStatusChanged(_settings, _enabled) { _onStatusChanged() {
logDebug(`Shell variants switching has been ${this._shellVariantsSettings.get_boolean('enabled') ? 'enabled' : 'disabled'}.`);
this.disable(); this.disable();
this.enable(); this.enable();
} }
_onVariantChanged(_settings, changedVariantTime) { _onDayVariantChanged() {
if (changedVariantTime === e.timer.time) logDebug(`Day Shell variant changed to '${this._shellVariantsSettings.get_string('day')}'.`);
this._setSystemVariant(e.timer.time); this._updateSystemShellTheme();
}
_onNightVariantChanged() {
logDebug(`Night Shell variant changed to '${this._shellVariantsSettings.get_string('night')}'.`);
this._updateSystemShellTheme();
} }
_onSystemShellThemeChanged(_settings, _newTheme) { _onSystemShellThemeChanged(_settings, _newTheme) {
if (!this._userthemesSettings)
return;
logDebug(`System Shell theme changed to '${this._userthemesSettings.get_string('name')}'.`);
try { try {
this._updateVariants(); this._updateVariants();
this._setSystemVariant(e.timer.time); this._updateCurrentVariant();
this._updateSystemShellTheme();
} catch (error) { } catch (error) {
notifyError(error); notifyError(error);
} }
} }
_onManualChanged(_settings, _enabled) { _onManualChanged() {
logDebug(`Manual Shell variants choice has been ${this._shellVariantsSettings.get_boolean('manual') ? 'enabled' : 'disabled'}.`);
this.disable(); this.disable();
this.enable(); this.enable();
} }
_onTimeChanged(_timer, newTime) { _onTimeChanged() {
this._setSystemVariant(newTime); this._updateSystemShellTheme();
} }
_areVariantsUpToDate() { _areVariantsUpToDate() {
return e.settings.system.shellTheme === e.settings.shellVariants.day || e.settings.system.shellTheme === e.settings.shellVariants.night; if (!this._userthemesSettings)
return true;
return (
this._userthemesSettings.get_string('name') === this._shellVariantsSettings.get_string('day') ||
this._userthemesSettings.get_string('name') === this._shellVariantsSettings.get_string('night')
);
} }
_setSystemVariant(time) { _updateCurrentVariant() {
if (!time) if (this._userthemesSettings && this._shellVariantsSettings.get_boolean('manual') && e.timer.time)
this._shellVariantsSettings.set_string(e.timer.time, this._userthemesSettings.get_string('name'));
}
_updateSystemShellTheme() {
if (!e.timer.time)
return; return;
logDebug(`Setting the shell ${time} variant...`); logDebug(`Setting the ${e.timer.time} Shell variant...`);
const shellTheme = time === 'day' ? e.settings.shellVariants.day : e.settings.shellVariants.night; const shellTheme = this._shellVariantsSettings.get_string(e.timer.time);
if (e.settings.system.useUserthemes) { if (this._userthemesSettings) {
e.settings.system.shellTheme = shellTheme; this._userthemesSettings.set_string('name', shellTheme);
} else { } else {
const stylesheet = getShellThemeStylesheet(shellTheme); const stylesheet = utils.getShellThemeStylesheet(shellTheme);
applyShellStylesheet(stylesheet); utils.applyShellStylesheet(stylesheet);
} }
} }
_updateVariants() { _updateVariants() {
if (!e.settings.system.useUserthemes || e.settings.shellVariants.manual || this._areVariantsUpToDate()) if (!this._userthemesSettings || this._shellVariantsSettings.get_boolean('manual') || this._areVariantsUpToDate())
return; return;
logDebug('Updating Shell variants...'); logDebug('Updating Shell variants...');
const originalTheme = e.settings.system.shellTheme; const originalTheme = this._userthemesSettings.get_string('name');
const variants = ShellVariants.guessFrom(originalTheme); const variants = ShellVariants.guessFrom(originalTheme);
const installedThemes = getInstalledShellThemes(); const installedThemes = utils.getInstalledShellThemes();
if (!installedThemes.has(variants.get('day')) || !installedThemes.has(variants.get('night'))) { if (!installedThemes.has(variants.get('day')) || !installedThemes.has(variants.get('night'))) {
const message = _('Unable to automatically detect the day and night variants for the "%s" GNOME Shell theme. Please manually choose them in the extension\'s preferences.').format(originalTheme); const message = _('Unable to automatically detect the day and night variants for the "%s" GNOME Shell theme. Please manually choose them in the extension\'s preferences.').format(originalTheme);
throw new Error(message); throw new Error(message);
} }
e.settings.shellVariants.day = variants.get('day'); this._shellVariantsSettings.set_string('day', variants.get('day'));
e.settings.shellVariants.night = variants.get('night'); this._shellVariantsSettings.set_string('night', variants.get('night'));
logDebug(`New Shell variants. { day: '${variants.get('day')}'; night: '${variants.get('night')}' }`); logDebug(`New Shell variants. { day: '${variants.get('day')}'; night: '${variants.get('night')}' }`);
} }
}; };
Signals.addSignalMethods(ShellThemer.prototype);
+46 -43
View File
@@ -1,13 +1,15 @@
// SPDX-FileCopyrightText: 2020, 2021 Romain Vigier <contact AT romainvigier.fr> // SPDX-FileCopyrightText: 2020, 2021 Romain Vigier <contact AT romainvigier.fr>
// SPDX-License-Identifier: GPL-3.0-or-later // SPDX-License-Identifier: GPL-3.0-or-later
const { Gio } = imports.gi;
const { extensionUtils } = imports.misc; const { extensionUtils } = imports.misc;
const Signals = imports.signals; const Signals = imports.signals;
const Me = extensionUtils.getCurrentExtension(); const Me = extensionUtils.getCurrentExtension();
const e = Me.imports.extension; const utils = Me.imports.utils;
const { logDebug } = Me.imports.utils; const { logDebug } = utils;
const { TimerNightlight } = Me.imports.modules.TimerNightlight; const { TimerNightlight } = Me.imports.modules.TimerNightlight;
const { TimerLocation } = Me.imports.modules.TimerLocation; const { TimerLocation } = Me.imports.modules.TimerLocation;
const { TimerSchedule } = Me.imports.modules.TimerSchedule; const { TimerSchedule } = Me.imports.modules.TimerSchedule;
@@ -31,13 +33,13 @@ const { TimerOndemand } = Me.imports.modules.TimerOndemand;
*/ */
var Timer = class { var Timer = class {
constructor() { constructor() {
this._timeSettings = extensionUtils.getSettings(utils.getSettingsSchema('time'));
this._colorSettings = new Gio.Settings({ schema: 'org.gnome.settings-daemon.plugins.color' });
this._locationSettings = new Gio.Settings({ schema: 'org.gnome.system.location' });
this._sources = []; this._sources = [];
this._previousTime = null; this._previousTime = null;
this._nightlightStatusChangedConnect = null; this._settingsConnections = [];
this._locationStatusChangedConnect = null; this._timeConnections = [];
this._manualTimeSourceChangedConnect = null;
this._timeSourceChangedConnect = null;
this._timeChangedConnects = [];
} }
enable() { enable() {
@@ -65,30 +67,31 @@ var Timer = class {
_connectSettings() { _connectSettings() {
logDebug('Connecting Timer to settings...'); logDebug('Connecting Timer to settings...');
this._nightlightStatusChangedConnect = e.settings.system.connect('nightlight-status-changed', this._onSourceChanged.bind(this)); this._settingsConnections.push({
this._locationStatusChangedConnect = e.settings.system.connect('location-status-changed', this._onSourceChanged.bind(this)); settings: this._colorSettings,
this._manualTimeSourceChangedConnect = e.settings.time.connect('manual-time-source-changed', this._onSourceChanged.bind(this)); id: this._colorSettings.connect('changed::night-light-enabled', this._onSourceChanged.bind(this)),
this._alwaysEnableOndemandChangedConnect = e.settings.time.connect('always-enable-ondemand-changed', this._onSourceChanged.bind(this)); });
this._timeSourceChangedConnect = e.settings.time.connect('time-source-changed', this._onTimeSourceChanged.bind(this)); this._settingsConnections.push({
settings: this._locationSettings,
id: this._locationSettings.connect('changed::enabled', this._onSourceChanged.bind(this)),
});
this._settingsConnections.push({
settings: this._timeSettings,
id: this._timeSettings.connect('changed::manual-time-source', this._onSourceChanged.bind(this)),
});
this._settingsConnections.push({
settings: this._timeSettings,
id: this._timeSettings.connect('changed::always-enable-ondemand', this._onSourceChanged.bind(this)),
});
this._settingsConnections.push({
settings: this._timeSettings,
id: this._timeSettings.connect('changed::time-source', this._onTimeSourceChanged.bind(this)),
});
} }
_disconnectSettings() { _disconnectSettings() {
if (this._nightlightStatusChangedConnect) { this._settingsConnections.forEach(connection => connection.settings.disconnect(connection.id));
e.settings.system.disconnect(this._nightlightStatusChangedConnect); this._settingsConnections = [];
this._nightlightStatusChangedConnect = null;
}
if (this._locationStatusChangedConnect) {
e.settings.system.disconnect(this._locationStatusChangedConnect);
this._locationStatusChangedConnect = null;
}
if (this._manualTimeSourceChangedConnect) {
e.settings.time.disconnect(this._manualTimeSourceChangedConnect);
this._manualTimeSourceChangedConnect = null;
}
if (this._timeSourceChangedConnect) {
e.settings.time.disconnect(this._timeSourceChangedConnect);
this._timeSourceChangedConnect = null;
}
logDebug('Disconnected Timer from settings.'); logDebug('Disconnected Timer from settings.');
} }
@@ -109,7 +112,7 @@ var Timer = class {
break; break;
} }
if (e.settings.time.alwaysEnableOndemand && ['nightlight', 'location', 'schedule'].includes(source)) if (this._timeSettings.get_boolean('always-enable-ondemand') && ['nightlight', 'location', 'schedule'].includes(source))
this._sources.unshift(new TimerOndemand()); this._sources.unshift(new TimerOndemand());
} }
@@ -124,15 +127,15 @@ var Timer = class {
_connectSources() { _connectSources() {
logDebug('Connecting to time sources...'); logDebug('Connecting to time sources...');
this._sources.forEach(source => this._timeChangedConnects.push({ this._sources.forEach(source => this._timeConnections.push({
source, source,
connect: source.connect('time-changed', this._onTimeChanged.bind(this)), id: source.connect('time-changed', this._onTimeChanged.bind(this)),
})); }));
} }
_disconnectSources() { _disconnectSources() {
this._timeChangedConnects.forEach(timeChangedConnect => timeChangedConnect.source.disconnect(timeChangedConnect.connect)); this._timeConnections.forEach(connection => connection.source.disconnect(connection.id));
this._timeChangedConnects = []; this._timeConnections = [];
logDebug('Disconnected from time sources.'); logDebug('Disconnected from time sources.');
} }
@@ -142,8 +145,8 @@ var Timer = class {
this.enable(); this.enable();
} }
_onTimeSourceChanged(_settings, _newSource) { _onTimeSourceChanged() {
if (e.settings.time.manualTimeSource) if (this._timeSettings.get_boolean('manual-time-source'))
this._onSourceChanged(); this._onSourceChanged();
} }
@@ -160,26 +163,26 @@ var Timer = class {
logDebug('Getting time source...'); logDebug('Getting time source...');
let source; let source;
if (e.settings.time.manualTimeSource) { if (this._timeSettings.get_boolean('manual-time-source')) {
source = e.settings.time.timeSource; source = this._timeSettings.get_string('time-source');
logDebug(`Time source is forced to ${source}.`); logDebug(`Time source is forced to ${source}.`);
if ( if (
(source === 'nightlight' && !e.settings.system.nightlightEnabled) || (source === 'nightlight' && !this._colorSettings.get_boolean('night-light-enabled')) ||
(source === 'location' && !e.settings.system.locationEnabled) (source === 'location' && !this._locationSettings.get_boolean('enabled'))
) { ) {
logDebug(`Unable to choose ${source} time source, falling back to manual schedule.`); logDebug(`Unable to choose ${source} time source, falling back to manual schedule.`);
source = 'schedule'; source = 'schedule';
e.settings.time.timeSource = source; this._timeSettings.set_string('time-source', source);
} }
} else { } else {
if (e.settings.system.nightlightEnabled) if (this._colorSettings.get_boolean('night-light-enabled'))
source = 'nightlight'; source = 'nightlight';
else if (e.settings.system.locationEnabled) else if (this._locationSettings.get_boolean('enabled'))
source = 'location'; source = 'location';
else else
source = 'schedule'; source = 'schedule';
logDebug(`Time source is ${source}.`); logDebug(`Time source is ${source}.`);
e.settings.time.timeSource = source; this._timeSettings.set_string('time-source', source);
} }
return source; return source;
} }
+10 -9
View File
@@ -7,8 +7,8 @@ const Signals = imports.signals;
const Me = extensionUtils.getCurrentExtension(); const Me = extensionUtils.getCurrentExtension();
const e = Me.imports.extension; const utils = Me.imports.utils;
const { logDebug } = Me.imports.utils; const { logDebug } = utils;
/** /**
@@ -29,12 +29,13 @@ var TimerLocation = class {
this._previouslyDaytime = null; this._previouslyDaytime = null;
// Before we have the location suntimes, we'll use the manual schedule // Before we have the location suntimes, we'll use the manual schedule
// times // times
const timeSettings = extensionUtils.getSettings(utils.getSettingsSchema('time'));
this._suntimes = new Map([ this._suntimes = new Map([
['sunrise', e.settings.time.scheduleSunrise], ['sunrise', timeSettings.get_double('schedule-sunrise')],
['sunset', e.settings.time.scheduleSunrise], ['sunset', timeSettings.get_double('schedule-sunset')],
]); ]);
this._geoclue = null; this._geoclue = null;
this._geoclueConnect = null; this._geoclueConnection = null;
this._timeChangeTimer = null; this._timeChangeTimer = null;
this._regularlyUpdateSuntimesTimer = null; this._regularlyUpdateSuntimesTimer = null;
} }
@@ -73,9 +74,9 @@ var TimerLocation = class {
_disconnectFromGeoclue() { _disconnectFromGeoclue() {
logDebug('Disconnecting from GeoClue...'); logDebug('Disconnecting from GeoClue...');
if (this._geoclueConnect) { if (this._geoclueConnection) {
this._geoclue.disconnect(this._geoclueConnect); this._geoclue.disconnect(this._geoclueConnection);
this._geoclueConnect = null; this._geoclueConnection = null;
} }
logDebug('Disconnected from GeoClue.'); logDebug('Disconnected from GeoClue.');
} }
@@ -83,7 +84,7 @@ var TimerLocation = class {
_onGeoclueReady(_, result) { _onGeoclueReady(_, result) {
this._geoclue = Geoclue.Simple.new_finish(result); this._geoclue = Geoclue.Simple.new_finish(result);
this._geoclueConnect = this._geoclue.connect('notify::location', this._onLocationUpdated.bind(this)); this._geoclueConnection = this._geoclue.connect('notify::location', this._onLocationUpdated.bind(this));
logDebug('Connected to GeoClue.'); logDebug('Connected to GeoClue.');
this._onLocationUpdated(); this._onLocationUpdated();
} }
+15 -13
View File
@@ -7,8 +7,8 @@ const Signals = imports.signals;
const Me = extensionUtils.getCurrentExtension(); const Me = extensionUtils.getCurrentExtension();
const e = Me.imports.extension; const utils = Me.imports.utils;
const { logDebug } = Me.imports.utils; const { logDebug } = utils;
const COLOR_INTERFACE = ` const COLOR_INTERFACE = `
@@ -28,9 +28,10 @@ const COLOR_INTERFACE = `
*/ */
var TimerNightlight = class { var TimerNightlight = class {
constructor() { constructor() {
this._timeSettings = extensionUtils.getSettings(utils.getSettingsSchema('time'));
this._colorDbusProxy = null; this._colorDbusProxy = null;
this._nightlightFollowDisableConnect = null; this._settingsConnections = [];
this._nightlightStateConnect = null; this._nightlightStateConnection = null;
this._previousNightlightActive = null; this._previousNightlightActive = null;
} }
@@ -76,32 +77,33 @@ var TimerNightlight = class {
_connectSettings() { _connectSettings() {
logDebug('Connecting Night Light Timer to settings...'); logDebug('Connecting Night Light Timer to settings...');
this._nightlightFollowDisableConnect = e.settings.time.connect('nightlight-follow-disable-changed', this._onNightlightFollowDisableChanged.bind(this)); this._settingsConnections.push({
settings: this._timeSettings,
id: this._timeSettings.connect('changed::nightlight-follow-disable', this._onNightlightFollowDisableChanged.bind(this)),
});
} }
_disconnectSettings() { _disconnectSettings() {
logDebug('Disconnecting Night Light Timer from settings...'); logDebug('Disconnecting Night Light Timer from settings...');
if (this._nightlightFollowDisableConnect) { this._settingsConnections.forEach(connection => connection.settings.disconnect(connection.id));
e.settings.time.disconnect(this._nightlightFollowDisableConnect); this._settingsConnections = [];
this._nightlightFollowDisableConnect = null;
}
} }
_listenToNightlightState() { _listenToNightlightState() {
logDebug('Listening to Night Light state...'); logDebug('Listening to Night Light state...');
this._nightlightStateConnect = this._colorDbusProxy.connect( this._nightlightStateConnection = this._colorDbusProxy.connect(
'g-properties-changed', 'g-properties-changed',
this._onNightlightStateChanged.bind(this) this._onNightlightStateChanged.bind(this)
); );
} }
_stopListeningToNightlightState() { _stopListeningToNightlightState() {
this._colorDbusProxy.disconnect(this._nightlightStateConnect); this._colorDbusProxy.disconnect(this._nightlightStateConnection);
logDebug('Stopped listening to Night Light state.'); logDebug('Stopped listening to Night Light state.');
} }
_onNightlightFollowDisableChanged(_settings, _value) { _onNightlightFollowDisableChanged() {
this._onNightlightStateChanged(); this._onNightlightStateChanged();
} }
@@ -115,7 +117,7 @@ var TimerNightlight = class {
_isNightlightActive() { _isNightlightActive() {
return e.settings.time.nightlightFollowDisable return this._timeSettings.get_boolean('nightlight-follow-disable')
? !this._colorDbusProxy.DisabledUntilTomorrow && this._colorDbusProxy.NightLightActive ? !this._colorDbusProxy.DisabledUntilTomorrow && this._colorDbusProxy.NightLightActive
: this._colorDbusProxy.NightLightActive; : this._colorDbusProxy.NightLightActive;
} }
+37 -38
View File
@@ -13,7 +13,8 @@ const { PopupBaseMenuItem } = imports.ui.popupMenu;
const Me = extensionUtils.getCurrentExtension(); const Me = extensionUtils.getCurrentExtension();
const e = Me.imports.extension; const e = Me.imports.extension;
const { logDebug, findShellAggregateMenuItemPosition } = Me.imports.utils; const utils = Me.imports.utils;
const { logDebug } = utils;
const Gettext = imports.gettext.domain(Me.metadata['gettext-domain']); const Gettext = imports.gettext.domain(Me.metadata['gettext-domain']);
const _ = Gettext.gettext; const _ = Gettext.gettext;
@@ -26,11 +27,11 @@ const _ = Gettext.gettext;
*/ */
var TimerOndemand = class { var TimerOndemand = class {
constructor() { constructor() {
this._timeSettings = extensionUtils.getSettings(utils.getSettingsSchema('time'));
this._settingsConnections = [];
this._button = null; this._button = null;
this._previousKeybinding = null; this._previousKeybinding = null;
this._ondemandKeybindingConnect = null; this._timerConnection = null;
this._ondemandButtonPlacementConnect = null;
this._timeChangedConnect = null;
} }
enable() { enable() {
@@ -54,75 +55,74 @@ var TimerOndemand = class {
get time() { get time() {
return e.settings.time.ondemandTime; return this._timeSettings.get_string('ondemand-time');
} }
_connectSettings() { _connectSettings() {
logDebug('Connecting On-demand Timer to settings...'); logDebug('Connecting On-demand Timer to settings...');
this._ondemandTimeConnect = e.settings.time.connect('ondemand-time-changed', this._onOndemandTimeChanged.bind(this)); this._settingsConnections.push({
this._ondemandKeybindingConnect = e.settings.time.connect('ondemand-keybinding-changed', this._onOndemandKeybindingChanged.bind(this)); settings: this._timeSettings,
this._ondemandButtonPlacementConnect = e.settings.time.connect('ondemand-button-placement-changed', this._onOndemandButtonPlacementChanged.bind(this)); id: this._timeSettings.connect('changed::ondemand-time', this._onOndemandTimeChanged.bind(this)),
});
this._settingsConnections.push({
settings: this._timeSettings,
id: this._timeSettings.connect('changed::nightthemeswitcher-ondemand-keybinding', this._onOndemandKeybindingChanged.bind(this)),
});
this._settingsConnections.push({
settings: this._timeSettings,
id: this._timeSettings.connect('changed::ondemand-button-placement', this._onOndemandButtonPlacementChanged.bind(this)),
});
} }
_disconnectSettings() { _disconnectSettings() {
logDebug('Disconnecting On-demand Timer from settings...'); logDebug('Disconnecting On-demand Timer from settings...');
if (this._ondemandTimeConnect) { this._settingsConnections.forEach(connection => connection.settings.disconnect(connection.id));
e.settings.time.disconnect(this._ondemandTimeConnect); this._settingsConnections = [];
this._ondemandTimeConnect = null;
}
if (this._ondemandKeybindingConnect) {
e.settings.time.disconnect(this._ondemandKeybindingConnect);
this._ondemandKeybindingConnect = null;
}
if (this._ondemandButtonPlacementConnect) {
e.settings.time.disconnect(this._ondemandButtonPlacementConnect);
this._ondemandButtonPlacementConnect = null;
}
} }
_connectTimer() { _connectTimer() {
logDebug('Connecting On-demand Timer to Timer...'); logDebug('Connecting On-demand Timer to Timer...');
this._timeChangedConnect = e.timer.connect('time-changed', this._onTimeChanged.bind(this)); this._timerConnection = e.timer.connect('time-changed', this._onTimeChanged.bind(this));
} }
_disconnectTimer() { _disconnectTimer() {
if (this._timeChangedConnect) { if (this._timerConnection) {
e.timer.disconnect(this._timeChangedConnect); e.timer.disconnect(this._timerConnection);
this._timeChangedConnect = null; this._timerConnection = null;
} }
logDebug('Disconnected On-demand Timer from Timer.'); logDebug('Disconnected On-demand Timer from Timer.');
} }
_onOndemandTimeChanged(_settings, _time) { _onOndemandTimeChanged() {
this.emit('time-changed', this.time); this.emit('time-changed', this.time);
} }
_onOndemandKeybindingChanged(_settings, _keybinding) { _onOndemandKeybindingChanged() {
this._removeKeybinding(); this._removeKeybinding();
this._addKeybinding(); this._addKeybinding();
} }
_onOndemandButtonPlacementChanged(_settings, _placement) { _onOndemandButtonPlacementChanged() {
this._removeButton(); this._removeButton();
this._addButton(); this._addButton();
} }
_onTimeChanged(_timer, _newTime) { _onTimeChanged(_timer, _newTime) {
e.settings.time.ondemandTime = e.timer.time; this._timeSettings.set_string('ondemand-time', e.timer.time);
this._updateButton(); this._updateButton();
} }
_addKeybinding() { _addKeybinding() {
this._previousKeybinding = e.settings.time.ondemandKeybinding; this._previousKeybinding = this._timeSettings.get_strv('nightthemeswitcher-ondemand-keybinding')[0];
if (!e.settings.time.ondemandKeybinding) if (!this._timeSettings.get_strv('nightthemeswitcher-ondemand-keybinding')[0])
return; return;
logDebug('Adding On-demand Timer keybinding...'); logDebug('Adding On-demand Timer keybinding...');
main.wm.addKeybinding( main.wm.addKeybinding(
'nightthemeswitcher-ondemand-keybinding', 'nightthemeswitcher-ondemand-keybinding',
e.settings.time.settings, this._timeSettings,
Meta.KeyBindingFlags.IGNORE_AUTOREPEAT, Meta.KeyBindingFlags.IGNORE_AUTOREPEAT,
Shell.ActionMode.NORMAL | Shell.ActionMode.OVERVIEW, Shell.ActionMode.NORMAL | Shell.ActionMode.OVERVIEW,
this._toggleTime.bind(this) this._toggleTime.bind(this)
@@ -139,13 +139,12 @@ var TimerOndemand = class {
} }
_addButton() { _addButton() {
switch (e.settings.time.ondemandButtonPlacement) { switch (this._timeSettings.get_string('ondemand-button-placement')) {
case 'panel': case 'panel':
this._addButtonToPanel(); this._addButtonToPanel();
break; break;
case 'menu': case 'menu':
this._addButtonToMenu(); this._addButtonToMenu();
break;
} }
} }
@@ -178,7 +177,7 @@ var TimerOndemand = class {
_addButtonToMenu() { _addButtonToMenu() {
logDebug('Adding On-demand Timer button to the menu...'); logDebug('Adding On-demand Timer button to the menu...');
const aggregateMenu = main.panel.statusArea.aggregateMenu; const aggregateMenu = main.panel.statusArea.aggregateMenu;
const position = findShellAggregateMenuItemPosition(aggregateMenu._system.menu) - 1; const position = utils.findShellAggregateMenuItemPosition(aggregateMenu._system.menu) - 1;
this._button = new NtsPopupMenuItem(); this._button = new NtsPopupMenuItem();
this._button.connect('activate', () => { this._button.connect('activate', () => {
this._toggleTime(); this._toggleTime();
@@ -188,7 +187,7 @@ var TimerOndemand = class {
} }
_toggleTime() { _toggleTime() {
e.settings.time.ondemandTime = e.timer.time === 'day' ? 'night' : 'day'; this._timeSettings.set_string('ondemand-time', e.timer.time === 'day' ? 'night' : 'day');
this.emit('time-changed', this.time); this.emit('time-changed', this.time);
} }
}; };
@@ -235,14 +234,14 @@ var NtsPopupMenuItem = GObject.registerClass(
} }
); );
const _getIconNameForTime = time => { var _getIconNameForTime = time => {
return time === 'day' ? 'nightthemeswitcher-ondemand-off-symbolic' : 'nightthemeswitcher-ondemand-on-symbolic'; return time === 'day' ? 'nightthemeswitcher-ondemand-off-symbolic' : 'nightthemeswitcher-ondemand-on-symbolic';
}; };
const _getGiconForTime = time => { var _getGiconForTime = time => {
return Gio.icon_new_for_string(GLib.build_filenamev([Me.path, 'icons', 'hicolor', 'scalable', 'status', `${this._getIconNameForTime(time)}.svg`])); return Gio.icon_new_for_string(GLib.build_filenamev([Me.path, 'icons', 'hicolor', 'scalable', 'status', `${this._getIconNameForTime(time)}.svg`]));
}; };
const _getLabelForTime = time => { var _getLabelForTime = time => {
return time === 'day' ? _('Switch to night theme') : _('Switch to day theme'); return time === 'day' ? _('Switch to night theme') : _('Switch to day theme');
}; };
+4 -3
View File
@@ -7,8 +7,8 @@ const Signals = imports.signals;
const Me = extensionUtils.getCurrentExtension(); const Me = extensionUtils.getCurrentExtension();
const e = Me.imports.extension; const utils = Me.imports.utils;
const { logDebug } = Me.imports.utils; const { logDebug } = utils;
/** /**
@@ -21,6 +21,7 @@ const { logDebug } = Me.imports.utils;
*/ */
var TimerSchedule = class { var TimerSchedule = class {
constructor() { constructor() {
this._timeSettings = extensionUtils.getSettings(utils.getSettingsSchema('time'));
this._previouslyDaytime = null; this._previouslyDaytime = null;
this._timeChangeTimer = null; this._timeChangeTimer = null;
} }
@@ -47,7 +48,7 @@ var TimerSchedule = class {
_isDaytime() { _isDaytime() {
const time = GLib.DateTime.new_now_local(); const time = GLib.DateTime.new_now_local();
const hour = time.get_hour() + time.get_minute() / 60 + time.get_second() / 3600; const hour = time.get_hour() + time.get_minute() / 60 + time.get_second() / 3600;
return hour >= e.settings.time.scheduleSunrise && hour <= e.settings.time.scheduleSunset; return hour >= this._timeSettings.get_double('schedule-sunrise') && hour <= this._timeSettings.get_double('schedule-sunset');
} }
_watchForTimeChange() { _watchForTimeChange() {
+5 -59
View File
@@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Night Theme Switcher\n" "Project-Id-Version: Night Theme Switcher\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-08-19 15:12+0200\n" "POT-Creation-Date: 2021-08-25 14:58+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -17,14 +17,14 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
#: src/modules/GtkThemer.js:162 #: src/modules/GtkThemer.js:184
#, javascript-format #, javascript-format
msgid "" msgid ""
"Unable to automatically detect the day and night variants for the \"%s\" GTK " "Unable to automatically detect the day and night variants for the \"%s\" GTK "
"theme. Please manually choose them in the extension's preferences." "theme. Please manually choose them in the extension's preferences."
msgstr "" msgstr ""
#: src/modules/ShellThemer.js:168 #: src/modules/ShellThemer.js:196
#, javascript-format #, javascript-format
msgid "" msgid ""
"Unable to automatically detect the day and night variants for the \"%s\" " "Unable to automatically detect the day and night variants for the \"%s\" "
@@ -32,11 +32,11 @@ msgid ""
"preferences." "preferences."
msgstr "" msgstr ""
#: src/modules/TimerOndemand.js:237 #: src/modules/TimerOndemand.js:246
msgid "Switch to night theme" msgid "Switch to night theme"
msgstr "" msgstr ""
#: src/modules/TimerOndemand.js:237 #: src/modules/TimerOndemand.js:246
msgid "Switch to day theme" msgid "Switch to day theme"
msgstr "" msgstr ""
@@ -69,215 +69,173 @@ msgid "The current extension settings version"
msgstr "" msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:17 #: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:17
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:10
msgid "Switch GTK variants" msgid "Switch GTK variants"
msgstr "" msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:18 #: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:18
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:11
msgid "Enable GTK variants switching" msgid "Enable GTK variants switching"
msgstr "" msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:22 #: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:22
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:15
msgid "Day GTK theme" msgid "Day GTK theme"
msgstr "" msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:23 #: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:23
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:16
msgid "The GTK theme to use during daytime" msgid "The GTK theme to use during daytime"
msgstr "" msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:27 #: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:27
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:20
msgid "Night GTK theme" msgid "Night GTK theme"
msgstr "" msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:28 #: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:28
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:21
msgid "The GTK theme to use during nighttime" msgid "The GTK theme to use during nighttime"
msgstr "" msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:32 #: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:32
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:25
msgid "Use manual GTK variants" msgid "Use manual GTK variants"
msgstr "" msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:33 #: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:33
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:26
msgid "Disable automatic GTK theme variants detection" msgid "Disable automatic GTK theme variants detection"
msgstr "" msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:39 #: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:39
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:30
msgid "Switch shell variants" msgid "Switch shell variants"
msgstr "" msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:40 #: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:40
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:31
msgid "Enable shell variants switching" msgid "Enable shell variants switching"
msgstr "" msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:44 #: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:44
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:35
msgid "Day shell theme" msgid "Day shell theme"
msgstr "" msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:45 #: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:45
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:36
msgid "The shell theme to use during daytime" msgid "The shell theme to use during daytime"
msgstr "" msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:49 #: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:49
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:40
msgid "Night shell theme" msgid "Night shell theme"
msgstr "" msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:50 #: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:50
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:41
msgid "The shell theme to use during nighttime" msgid "The shell theme to use during nighttime"
msgstr "" msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:54 #: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:54
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:45
msgid "Use manual shell variants" msgid "Use manual shell variants"
msgstr "" msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:55 #: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:55
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:46
msgid "Disable automatic shell theme variants detection" msgid "Disable automatic shell theme variants detection"
msgstr "" msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:61 #: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:61
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:50
msgid "Switch icon variants" msgid "Switch icon variants"
msgstr "" msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:62 #: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:62
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:51
msgid "Enable icon variants switching" msgid "Enable icon variants switching"
msgstr "" msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:66 #: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:66
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:55
msgid "Day icon theme" msgid "Day icon theme"
msgstr "" msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:67 #: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:67
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:56
msgid "The icon theme to use during daytime" msgid "The icon theme to use during daytime"
msgstr "" msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:71 #: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:71
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:60
msgid "Night icon theme" msgid "Night icon theme"
msgstr "" msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:72 #: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:72
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:61
msgid "The icon theme to use during nighttime" msgid "The icon theme to use during nighttime"
msgstr "" msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:78 #: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:78
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:65
msgid "Switch cursor variants" msgid "Switch cursor variants"
msgstr "" msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:79 #: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:79
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:66
msgid "Enable cursor variants switching" msgid "Enable cursor variants switching"
msgstr "" msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:83 #: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:83
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:70
msgid "Day cursor theme" msgid "Day cursor theme"
msgstr "" msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:84 #: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:84
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:71
msgid "The cursor theme to use during daytime" msgid "The cursor theme to use during daytime"
msgstr "" msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:88 #: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:88
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:75
msgid "Night cursor theme" msgid "Night cursor theme"
msgstr "" msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:89 #: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:89
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:76
msgid "The cursor theme to use during nighttime" msgid "The cursor theme to use during nighttime"
msgstr "" msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:95 #: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:95
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:130
msgid "Enable commands" msgid "Enable commands"
msgstr "" msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:96 #: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:96
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:131
msgid "Commands will be spawned on time change" msgid "Commands will be spawned on time change"
msgstr "" msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:100 #: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:100
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:135
msgid "Sunrise command" msgid "Sunrise command"
msgstr "" msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:101 #: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:101
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:136
msgid "The command to spawn at sunrise" msgid "The command to spawn at sunrise"
msgstr "" msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:105 #: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:105
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:140
msgid "Sunset command" msgid "Sunset command"
msgstr "" msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:106 #: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:106
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:141
msgid "The command to spawn at sunset" msgid "The command to spawn at sunset"
msgstr "" msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:112 #: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:112
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:145
msgid "Enable backgrounds" msgid "Enable backgrounds"
msgstr "" msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:113 #: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:113
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:146
msgid "Background will be changed on time change" msgid "Background will be changed on time change"
msgstr "" msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:117 #: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:117
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:150
#: src/preferences/ui/BackgroundsPreferences.ui:39 #: src/preferences/ui/BackgroundsPreferences.ui:39
msgid "Day background" msgid "Day background"
msgstr "" msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:118 #: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:118
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:151
msgid "Path to the day background" msgid "Path to the day background"
msgstr "" msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:122 #: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:122
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:155
#: src/preferences/ui/BackgroundsPreferences.ui:47 #: src/preferences/ui/BackgroundsPreferences.ui:47
msgid "Night background" msgid "Night background"
msgstr "" msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:123 #: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:123
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:156
msgid "Path to the night background" msgid "Path to the night background"
msgstr "" msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:135 #: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:135
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:86
#: src/preferences/ui/Schedule.ui:36 #: src/preferences/ui/Schedule.ui:36
msgid "Time source" msgid "Time source"
msgstr "" msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:136 #: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:136
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:87
msgid "The source used to check current time" msgid "The source used to check current time"
msgstr "" msgstr ""
@@ -298,62 +256,50 @@ msgid "The on-demand timer will always be enabled alongside other timers"
msgstr "" msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:154 #: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:154
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:95
msgid "On-demand time" msgid "On-demand time"
msgstr "" msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:155 #: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:155
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:96
msgid "The current time used in on-demand mode" msgid "The current time used in on-demand mode"
msgstr "" msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:159 #: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:159
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:100
msgid "Key combination to toggle time" msgid "Key combination to toggle time"
msgstr "" msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:160 #: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:160
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:101
msgid "The key combination that will toggle time in on-demand mode" msgid "The key combination that will toggle time in on-demand mode"
msgstr "" msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:169 #: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:169
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:110
msgid "On-demand button placement" msgid "On-demand button placement"
msgstr "" msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:170 #: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:170
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:111
msgid "Where the on-demand button will be placed" msgid "Where the on-demand button will be placed"
msgstr "" msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:174 #: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:174
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:115
msgid "Use manual time source" msgid "Use manual time source"
msgstr "" msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:175 #: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:175
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:116
msgid "Disable automatic time source detection" msgid "Disable automatic time source detection"
msgstr "" msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:179 #: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:179
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:120
msgid "Sunrise time" msgid "Sunrise time"
msgstr "" msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:180 #: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:180
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:121
msgid "When the day starts" msgid "When the day starts"
msgstr "" msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:184 #: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:184
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:125
msgid "Sunset time" msgid "Sunset time"
msgstr "" msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:185 #: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:185
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:126
msgid "When the day ends" msgid "When the day ends"
msgstr "" msgstr ""
@@ -1,159 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
SPDX-FileCopyrightText: 2021 Romain Vigier <contact AT romainvigier.fr>
SPDX-License-Identifier: GPL-3.0-or-later
-->
<schemalist gettext-domain="nightthemeswitcher@romainvigier.fr">
<schema id="org.gnome.shell.extensions.nightthemeswitcher.v0" path="/org/gnome/shell/extensions/nightthemeswitcher/">
<key name="gtk-variants-enabled" type="b">
<default>true</default>
<summary>Switch GTK variants</summary>
<description>Enable GTK variants switching</description>
</key>
<key name="gtk-variant-day" type="s">
<default>"Adwaita"</default>
<summary>Day GTK theme</summary>
<description>The GTK theme to use during daytime</description>
</key>
<key name="gtk-variant-night" type="s">
<default>"Adwaita-dark"</default>
<summary>Night GTK theme</summary>
<description>The GTK theme to use during nighttime</description>
</key>
<key name="manual-gtk-variants" type="b">
<default>false</default>
<summary>Use manual GTK variants</summary>
<description>Disable automatic GTK theme variants detection</description>
</key>
<key name="shell-variants-enabled" type="b">
<default>true</default>
<summary>Switch shell variants</summary>
<description>Enable shell variants switching</description>
</key>
<key name="shell-variant-day" type="s">
<default>""</default>
<summary>Day shell theme</summary>
<description>The shell theme to use during daytime</description>
</key>
<key name="shell-variant-night" type="s">
<default>""</default>
<summary>Night shell theme</summary>
<description>The shell theme to use during nighttime</description>
</key>
<key name="manual-shell-variants" type="b">
<default>false</default>
<summary>Use manual shell variants</summary>
<description>Disable automatic shell theme variants detection</description>
</key>
<key name="icon-variants-enabled" type="b">
<default>false</default>
<summary>Switch icon variants</summary>
<description>Enable icon variants switching</description>
</key>
<key name="icon-variant-day" type="s">
<default>""</default>
<summary>Day icon theme</summary>
<description>The icon theme to use during daytime</description>
</key>
<key name="icon-variant-night" type="s">
<default>""</default>
<summary>Night icon theme</summary>
<description>The icon theme to use during nighttime</description>
</key>
<key name="cursor-variants-enabled" type="b">
<default>false</default>
<summary>Switch cursor variants</summary>
<description>Enable cursor variants switching</description>
</key>
<key name="cursor-variant-day" type="s">
<default>""</default>
<summary>Day cursor theme</summary>
<description>The cursor theme to use during daytime</description>
</key>
<key name="cursor-variant-night" type="s">
<default>""</default>
<summary>Night cursor theme</summary>
<description>The cursor theme to use during nighttime</description>
</key>
<key name="time-source" type="s">
<choices>
<choice value="nightlight"/>
<choice value="location"/>
<choice value="schedule"/>
<choice value="ondemand"/>
</choices>
<default>"schedule"</default>
<summary>Time source</summary>
<description>The source used to check current time</description>
</key>
<key name="ondemand-time" type="s">
<choices>
<choice value="day"/>
<choice value="night"/>
</choices>
<default>"day"</default>
<summary>On-demand time</summary>
<description>The current time used in on-demand mode</description>
</key>
<key name="nightthemeswitcher-ondemand-keybinding" type="as">
<default><![CDATA[['<Shift><Super>t']]]></default>
<summary>Key combination to toggle time</summary>
<description>The key combination that will toggle time in on-demand mode</description>
</key>
<key name="ondemand-button-placement" type="s">
<choices>
<choice value="none"/>
<choice value="panel"/>
<choice value="menu"/>
</choices>
<default>"panel"</default>
<summary>On-demand button placement</summary>
<description>Where the on-demand button will be placed</description>
</key>
<key name="manual-time-source" type="b">
<default>false</default>
<summary>Use manual time source</summary>
<description>Disable automatic time source detection</description>
</key>
<key name="schedule-sunrise" type="d">
<default>6</default>
<summary>Sunrise time</summary>
<description>When the day starts</description>
</key>
<key name="schedule-sunset" type="d">
<default>20</default>
<summary>Sunset time</summary>
<description>When the day ends</description>
</key>
<key name="commands-enabled" type="b">
<default>false</default>
<summary>Enable commands</summary>
<description>Commands will be spawned on time change</description>
</key>
<key name="command-sunrise" type="s">
<default>""</default>
<summary>Sunrise command</summary>
<description>The command to spawn at sunrise</description>
</key>
<key name="command-sunset" type="s">
<default>""</default>
<summary>Sunset command</summary>
<description>The command to spawn at sunset</description>
</key>
<key name="backgrounds-enabled" type="b">
<default>false</default>
<summary>Enable backgrounds</summary>
<description>Background will be changed on time change</description>
</key>
<key name="background-day" type="s">
<default>""</default>
<summary>Day background</summary>
<description>Path to the day background</description>
</key>
<key name="background-night" type="s">
<default>""</default>
<summary>Night background</summary>
<description>Path to the night background</description>
</key>
</schema>
</schemalist>
-81
View File
@@ -1,81 +0,0 @@
// SPDX-FileCopyrightText: 2020, 2021 Romain Vigier <contact AT romainvigier.fr>
// SPDX-License-Identifier: GPL-3.0-or-later
const { extensionUtils } = imports.misc;
const Signals = imports.signals;
const Me = extensionUtils.getCurrentExtension();
const { logDebug, getSettingsSchema } = Me.imports.utils;
var BackgroundsSettings = class {
constructor() {
logDebug('Initializing backgrounds settings...');
this.settings = extensionUtils.getSettings(getSettingsSchema('backgrounds'));
logDebug('Backgrounds settings initialized.');
}
enable() {
logDebug('Connecting backgrounds settings signals...');
this._enabledChangedConnect = this.settings.connect('changed::enabled', this._onEnabledChanged.bind(this));
this._dayChangedConnect = this.settings.connect('changed::day', this._onDayChanged.bind(this));
this._nightChangedConnect = this.settings.connect('changed::night', this._onNightChanged.bind(this));
logDebug('Backgrounds settings signals connected.');
}
disable() {
logDebug('Disconnecting backgrounds settings signals...');
this.settings.disconnect(this._enabledChangedConnect);
this.settings.disconnect(this._dayChangedConnect);
this.settings.disconnect(this._nightChangedConnect);
logDebug('Backgrounds settings signals disconnected.');
}
get enabled() {
return this.settings.get_boolean('enabled');
}
set enabled(value) {
if (value !== this.enabled)
this.settings.set_boolean('enabled', value);
}
get day() {
return this.settings.get_string('day');
}
set day(value) {
if (value !== this.day)
this.settings.set_string('day', value);
}
get night() {
return this.settings.get_string('night');
}
set night(value) {
if (value !== this.night)
this.settings.set_string('night', value);
}
_onEnabledChanged(_settings, _changedKey) {
logDebug(`Backgrounds have been ${this.enabled ? 'ena' : 'disa'}bled.`);
this.emit('status-changed', this.enabled);
}
_onDayChanged(_settings, _changedKey) {
logDebug(`Day background has changed to '${this.day}'.`);
this.emit('background-changed', 'day');
this.emit('day-changed');
}
_onNightChanged(_settings, _changedKey) {
logDebug(`Night background has changed to '${this.night}'.`);
this.emit('background-changed', 'night');
this.emit('night-changed');
}
};
Signals.addSignalMethods(BackgroundsSettings.prototype);
-81
View File
@@ -1,81 +0,0 @@
// SPDX-FileCopyrightText: 2020, 2021 Romain Vigier <contact AT romainvigier.fr>
// SPDX-License-Identifier: GPL-3.0-or-later
const { extensionUtils } = imports.misc;
const Signals = imports.signals;
const Me = extensionUtils.getCurrentExtension();
const { logDebug, getSettingsSchema } = Me.imports.utils;
var CommandsSettings = class {
constructor() {
logDebug('Initializing commands settings...');
this.settings = extensionUtils.getSettings(getSettingsSchema('commands'));
logDebug('Commands settings initialized.');
}
enable() {
logDebug('Connecting commands settings signals...');
this._enabledChangedConnect = this.settings.connect('changed::enabled', this._onEnabledChanged.bind(this));
this._sunriseChangedConnect = this.settings.connect('changed::sunrise', this._onSunriseChanged.bind(this));
this._sunsetChangedConnect = this.settings.connect('changed::sunset', this._onSunsetChanged.bind(this));
logDebug('Commands settings signals connected.');
}
disable() {
logDebug('Disconnecting commands settings signals...');
this.settings.disconnect(this._enabledChangedConnect);
this.settings.disconnect(this._sunriseChangedConnect);
this.settings.disconnect(this._sunsetChangedConnect);
logDebug('Commands settings signals disconnected.');
}
get enabled() {
return this.settings.get_boolean('enabled');
}
set enabled(value) {
if (value !== this.enabled)
this.settings.set_boolean('enabled', value);
}
get sunrise() {
return this.settings.get_string('sunrise');
}
set sunrise(value) {
if (value !== this.sunrise)
this.settings.set_string('sunrise', value);
}
get sunset() {
return this.settings.get_string('sunset');
}
set sunset(value) {
if (value !== this.sunset)
this.settings.set_string('sunset', value);
}
_onEnabledChanged(_settings, _changedKey) {
logDebug(`Commands have been ${this.enabled ? 'ena' : 'disa'}bled.`);
this.emit('status-changed', this.enabled);
}
_onSunriseChanged(_settings, _changedKey) {
logDebug(`Sunrise command changed to '${this.sunrise}'.`);
this.emit('command-changed', 'sunrise');
this.emit('sunrise-changed');
}
_onSunsetChanged(_settings, _changedKey) {
logDebug(`Sunset command has changed to '${this.sunset}'.`);
this.emit('command-changed', 'sunset');
this.emit('sunset-changed');
}
};
Signals.addSignalMethods(CommandsSettings.prototype);
-83
View File
@@ -1,83 +0,0 @@
// SPDX-FileCopyrightText: 2020, 2021 Romain Vigier <contact AT romainvigier.fr>
// SPDX-License-Identifier: GPL-3.0-or-later
const { extensionUtils } = imports.misc;
const Signals = imports.signals;
const Me = extensionUtils.getCurrentExtension();
const { logDebug, getSettingsSchema } = Me.imports.utils;
var CursorVariantsSettings = class {
constructor() {
logDebug('Initializing cursor variants settings...');
this.settings = extensionUtils.getSettings(getSettingsSchema('cursor-variants'));
logDebug('Cursor variants settings initialized.');
}
enable() {
logDebug('Connecting cursor variants settings signals...');
this._enabledChangedConnect = this.settings.connect('changed::enabled', this._onEnabledChanged.bind(this));
this._dayChangedConnect = this.settings.connect('changed::day', this._onDayChanged.bind(this));
this._nightChangedConnect = this.settings.connect('changed::night', this._onNightChanged.bind(this));
logDebug('Cursor variants settings signals connected.');
}
disable() {
logDebug('Disconnecting cursor variants settings signals...');
this.settings.disconnect(this._enabledChangedConnect);
this.settings.disconnect(this._dayChangedConnect);
this.settings.disconnect(this._nightChangedConnect);
logDebug('Cursor variants settings signals disconnected.');
}
get enabled() {
return this.settings.get_boolean('enabled');
}
set enabled(value) {
if (value !== this.enabled)
this.settings.set_boolean('enabled', value);
}
get day() {
return this.settings.get_string('day');
}
set day(value) {
if (value !== this.day) {
this.settings.set_string('day', value);
logDebug(`The cursor day variant has been set to '${value}'.`);
}
}
get night() {
return this.settings.get_string('night');
}
set night(value) {
if (value !== this.night) {
this.settings.set_string('night', value);
logDebug(`The cursor night variant has been set to '${value}'.`);
}
}
_onEnabledChanged(_settings, _changedKey) {
logDebug(`Cursor variants have been ${this.enabled ? 'ena' : 'disa'}bled.`);
this.emit('status-changed', this.enabled);
}
_onDayChanged(_settings, _changedKey) {
logDebug(`Cursor day variant has changed to '${this.day}'.`);
this.emit('variant-changed', 'day');
}
_onNightChanged(_settings, _changedKey) {
logDebug(`Cursor night variant has changed to '${this.night}'.`);
this.emit('variant-changed', 'night');
}
};
Signals.addSignalMethods(CursorVariantsSettings.prototype);
-99
View File
@@ -1,99 +0,0 @@
// SPDX-FileCopyrightText: 2020, 2021 Romain Vigier <contact AT romainvigier.fr>
// SPDX-License-Identifier: GPL-3.0-or-later
const { extensionUtils } = imports.misc;
const Signals = imports.signals;
const Me = extensionUtils.getCurrentExtension();
const { logDebug, getSettingsSchema } = Me.imports.utils;
var GtkVariantsSettings = class {
constructor() {
logDebug('Initializing GTK variants settings...');
this.settings = extensionUtils.getSettings(getSettingsSchema('gtk-variants'));
logDebug('GTK variants settings initialized.');
}
enable() {
logDebug('Connecting GTK variants settings signals...');
this._enabledChangedConnect = this.settings.connect('changed::enabled', this._onEnabledChanged.bind(this));
this._dayChangedConnect = this.settings.connect('changed::day', this._onDayChanged.bind(this));
this._nightChangedConnect = this.settings.connect('changed::night', this._onNightChanged.bind(this));
this._manualChangedConnect = this.settings.connect('changed::manual', this._onManualChanged.bind(this));
logDebug('GTK variants settings signals connected.');
}
disable() {
logDebug('Disconnecting GTK variants settings signals...');
this.settings.disconnect(this._enabledChangedConnect);
this.settings.disconnect(this._dayChangedConnect);
this.settings.disconnect(this._nightChangedConnect);
this.settings.disconnect(this._manualChangedConnect);
logDebug('GTK variants settings signals disconnected.');
}
get enabled() {
return this.settings.get_boolean('enabled');
}
set enabled(value) {
if (value !== this.enabled)
this.settings.set_boolean('enabled', value);
}
get day() {
return this.settings.get_string('day');
}
set day(value) {
if (value !== this.day) {
this.settings.set_string('day', value);
logDebug(`The GTK day variant has been set to '${value}'.`);
}
}
get night() {
return this.settings.get_string('night');
}
set night(value) {
if (value !== this.night) {
this.settings.set_string('night', value);
logDebug(`The GTK night variant has been set to '${value}'.`);
}
}
get manual() {
return this.settings.get_boolean('manual');
}
set manual(value) {
if (value !== this.manual)
this.settings.set_boolean('manual', value);
}
_onEnabledChanged(_settings, _changedKey) {
logDebug(`GTK variants have been ${this.enabled ? 'ena' : 'disa'}bled.`);
this.emit('status-changed', this.enabled);
}
_onDayChanged(_settings, _changedKey) {
logDebug(`GTK day variant has changed to '${this.day}'.`);
this.emit('variant-changed', 'day');
}
_onNightChanged(_settings, _changedKey) {
logDebug(`GTK night variant has changed to '${this.night}'.`);
this.emit('variant-changed', 'night');
}
_onManualChanged(_settings, _changedKey) {
logDebug(`Manual GTK variants have been ${this.manual ? 'ena' : 'disa'}bled.`);
this.emit('manual-changed', this.manual);
}
};
Signals.addSignalMethods(GtkVariantsSettings.prototype);
-83
View File
@@ -1,83 +0,0 @@
// SPDX-FileCopyrightText: 2020, 2021 Romain Vigier <contact AT romainvigier.fr>
// SPDX-License-Identifier: GPL-3.0-or-later
const { extensionUtils } = imports.misc;
const Signals = imports.signals;
const Me = extensionUtils.getCurrentExtension();
const { logDebug, getSettingsSchema } = Me.imports.utils;
var IconVariantsSettings = class {
constructor() {
logDebug('Initializing icon variants settings...');
this.settings = extensionUtils.getSettings(getSettingsSchema('icon-variants'));
logDebug('Icon variants settings initialized.');
}
enable() {
logDebug('Connecting icon variants settings signals...');
this._enabledChangedConnect = this.settings.connect('changed::enabled', this._onEnabledChanged.bind(this));
this._dayChangedConnect = this.settings.connect('changed::day', this._onDayChanged.bind(this));
this._nightChangedConnect = this.settings.connect('changed::night', this._onNightChanged.bind(this));
logDebug('Icon variants settings signals connected.');
}
disable() {
logDebug('Disconnecting icon variants settings signals...');
this.settings.disconnect(this._enabledChangedConnect);
this.settings.disconnect(this._dayChangedConnect);
this.settings.disconnect(this._nightChangedConnect);
logDebug('Icon variants settings signals disconnected.');
}
get enabled() {
return this.settings.get_boolean('enabled');
}
set enabled(value) {
if (value !== this.enabled)
this.settings.set_boolean('enabled', value);
}
get day() {
return this.settings.get_string('day');
}
set day(value) {
if (value !== this.day) {
this.settings.set_string('day', value);
logDebug(`The icon day variant has been set to '${value}'.`);
}
}
get night() {
return this.settings.get_string('night');
}
set night(value) {
if (value !== this.night) {
this.settings.set_string('night', value);
logDebug(`The icon night variant has been set to '${value}'.`);
}
}
_onEnabledChanged(_settings, _changedKey) {
logDebug(`Icon variants have been ${this.enabled ? 'ena' : 'disa'}bled.`);
this.emit('status-changed', this.enabled);
}
_onDayChanged(_settings, _changedKey) {
logDebug(`Icon day variant has changed to '${this.day}'.`);
this.emit('variant-changed', 'day');
}
_onNightChanged(_settings, _changedKey) {
logDebug(`Icon night variant has changed to '${this.night}'.`);
this.emit('variant-changed', 'night');
}
};
Signals.addSignalMethods(IconVariantsSettings.prototype);
-76
View File
@@ -1,76 +0,0 @@
// SPDX-FileCopyrightText: 2020, 2021 Romain Vigier <contact AT romainvigier.fr>
// SPDX-License-Identifier: GPL-3.0-or-later
const { extensionUtils } = imports.misc;
const Me = extensionUtils.getCurrentExtension();
const { logDebug, notifyError, getSettingsSchema } = Me.imports.utils;
const { BackgroundsSettings } = Me.imports.settings.Backgrounds;
const { CommandsSettings } = Me.imports.settings.Commands;
const { CursorVariantsSettings } = Me.imports.settings.CursorVariants;
const { GtkVariantsSettings } = Me.imports.settings.GtkVariants;
const { IconVariantsSettings } = Me.imports.settings.IconVariants;
const { ShellVariantsSettings } = Me.imports.settings.ShellVariants;
const { SystemSettings } = Me.imports.settings.System;
const { TimeSettings } = Me.imports.settings.Time;
var Settings = class {
constructor() {
logDebug('Initializing settings...');
this.extension = extensionUtils.getSettings();
this.backgrounds = new BackgroundsSettings();
this.commands = new CommandsSettings();
this.cursorVariants = new CursorVariantsSettings();
this.gtkVariants = new GtkVariantsSettings();
this.iconVariants = new IconVariantsSettings();
this.shellVariants = new ShellVariantsSettings();
this.system = new SystemSettings();
this.time = new TimeSettings();
logDebug('Settings initialized.');
this._migrate();
}
enable() {
logDebug('Connecting settings signals...');
this.backgrounds.enable();
this.commands.enable();
this.cursorVariants.enable();
this.gtkVariants.enable();
this.iconVariants.enable();
this.shellVariants.enable();
this.system.enable();
this.time.enable();
logDebug('Settings signals connected.');
}
disable() {
logDebug('Disconnecting settings signals...');
this.backgrounds.disable();
this.commands.disable();
this.cursorVariants.disable();
this.gtkVariants.disable();
this.iconVariants.disable();
this.shellVariants.disable();
this.system.disable();
this.time.disable();
logDebug('Settings signals disconnected.');
}
_migrate() {
const settingsVersion = this.extension.get_int('settings-version');
if (settingsVersion === 0) {
try {
logDebug('Migrating settings from v0 to v1...');
Me.imports.settings.migrations.v0ToV1.migrate(this);
this.extension.set_int('settings-version', 1);
logDebug('Migrated settings from v0 to v1.');
} catch (e) {
notifyError(e);
}
}
}
};
-99
View File
@@ -1,99 +0,0 @@
// SPDX-FileCopyrightText: 2020, 2021 Romain Vigier <contact AT romainvigier.fr>
// SPDX-License-Identifier: GPL-3.0-or-later
const { extensionUtils } = imports.misc;
const Signals = imports.signals;
const Me = extensionUtils.getCurrentExtension();
const { logDebug, getSettingsSchema } = Me.imports.utils;
var ShellVariantsSettings = class {
constructor() {
logDebug('Initializing shell variants settings...');
this.settings = extensionUtils.getSettings(getSettingsSchema('shell-variants'));
logDebug('Shell variants settings initialized.');
}
enable() {
logDebug('Connecting shell variants settings signals...');
this._enabledChangedConnect = this.settings.connect('changed::enabled', this._onEnabledChanged.bind(this));
this._dayChangedConnect = this.settings.connect('changed::day', this._onDayChanged.bind(this));
this._nightChangedConnect = this.settings.connect('changed::night', this._onNightChanged.bind(this));
this._manualChangedConnect = this.settings.connect('changed::manual', this._onManualChanged.bind(this));
logDebug('Shell variants settings signals connected.');
}
disable() {
logDebug('Disconnecting shell variants settings signals...');
this.settings.disconnect(this._enabledChangedConnect);
this.settings.disconnect(this._dayChangedConnect);
this.settings.disconnect(this._nightChangedConnect);
this.settings.disconnect(this._manualChangedConnect);
logDebug('Shell variants settings signals disconnected.');
}
get enabled() {
return this.settings.get_boolean('enabled');
}
set enabled(value) {
if (value !== this.enabled)
this.settings.set_boolean('enabled', value);
}
get day() {
return this.settings.get_string('day');
}
set day(value) {
if (value !== this.day) {
this.settings.set_string('day', value);
logDebug(`The shell day variant has been set to '${value}'.`);
}
}
get night() {
return this.settings.get_string('night');
}
set night(value) {
if (value !== this.night) {
this.settings.set_string('night', value);
logDebug(`The shell night variant has been set to '${value}'.`);
}
}
get manual() {
return this.settings.get_boolean('manual');
}
set manual(value) {
if (value !== this.manual)
this.settings.set_boolean('manual', value);
}
_onEnabledChanged(_settings, _changedKey) {
logDebug(`Shell variants have been ${this.enabled ? 'ena' : 'disa'}bled.`);
this.emit('status-changed', this.enabled);
}
_onDayChanged(_settings, _changedKey) {
logDebug(`Shell day variant has changed to '${this.day}'.`);
this.emit('variant-changed', 'day');
}
_onNightChanged(_settings, _changedKey) {
logDebug(`Shell night variant has changed to '${this.night}'.`);
this.emit('variant-changed', 'night');
}
_onManualChanged(_settings, _changedKey) {
logDebug(`Manual Shell variants have been ${this.manual ? 'ena' : 'disa'}bled.`);
this.emit('manual-changed', this.manual);
}
};
Signals.addSignalMethods(ShellVariantsSettings.prototype);
-159
View File
@@ -1,159 +0,0 @@
// SPDX-FileCopyrightText: 2020, 2021 Romain Vigier <contact AT romainvigier.fr>
// SPDX-License-Identifier: GPL-3.0-or-later
const { Gio } = imports.gi;
const { extensionUtils } = imports.misc;
const Signals = imports.signals;
const Me = extensionUtils.getCurrentExtension();
const { logDebug, getUserthemesExtension, getUserthemesSettings } = Me.imports.utils;
/**
* The Settings Manager centralizes all the different settings the extension
* needs. It handles getting and settings values as well as signaling any
* changes.
*/
var SystemSettings = class {
constructor() {
logDebug('Initializing system settings...');
this.colorSettings = new Gio.Settings({ schema: 'org.gnome.settings-daemon.plugins.color' });
this.locationSettings = new Gio.Settings({ schema: 'org.gnome.system.location' });
this.interfaceSettings = new Gio.Settings({ schema: 'org.gnome.desktop.interface' });
this.backgroundSettings = new Gio.Settings({ schema: 'org.gnome.desktop.background' });
this.userthemesSettings = getUserthemesSettings();
logDebug('System settings initialized.');
}
enable() {
logDebug('Connecting system settings signals...');
this._nightlightStatusConnect = this.colorSettings.connect('changed::night-light-enabled', this._onNightlightStatusChanged.bind(this));
this._locationStatusConnect = this.locationSettings.connect('changed::enabled', this._onLocationStatusChanged.bind(this));
this._gtkThemeChangedConnect = this.interfaceSettings.connect('changed::gtk-theme', this._onGtkThemeChanged.bind(this));
this._iconThemeChangedConnect = this.interfaceSettings.connect('changed::icon-theme', this._onIconThemeChanged.bind(this));
this._cursorThemeChangedConnect = this.interfaceSettings.connect('changed::cursor-theme', this._onCursorThemeChanged.bind(this));
this._backgroundChangedConnect = this.backgroundSettings.connect('changed::picture-uri', this._onBackgroundChanged.bind(this));
if (this.userthemesSettings)
this._shell_theme_changed_connect = this.userthemesSettings.connect('changed::name', this._onShellThemeChanged.bind(this));
logDebug('System settings signals connected.');
}
disable() {
logDebug('Disconnecting system settings signals...');
this.colorSettings.disconnect(this._nightlightStatusConnect);
this.locationSettings.disconnect(this._locationStatusConnect);
this.interfaceSettings.disconnect(this._gtkThemeChangedConnect);
this.interfaceSettings.disconnect(this._iconThemeChangedConnect);
this.interfaceSettings.disconnect(this._cursorThemeChangedConnect);
this.backgroundSettings.disconnect(this._backgroundChangedConnect);
if (this.userthemesSettings)
this.userthemesSettings.disconnect(this._shell_theme_changed_connect);
logDebug('System settings signals disconnected.');
}
get nightlightEnabled() {
return this.colorSettings.get_boolean('night-light-enabled');
}
get locationEnabled() {
return this.locationSettings.get_boolean('enabled');
}
get gtkTheme() {
return this.interfaceSettings.get_string('gtk-theme');
}
set gtkTheme(value) {
if (value !== this.gtkTheme) {
this.interfaceSettings.set_string('gtk-theme', value);
logDebug(`GTK theme has been set to '${value}'.`);
}
}
get shellTheme() {
if (this.userthemesSettings)
return this.userthemesSettings.get_string('name');
else
return '';
}
set shellTheme(value) {
if (this.userthemesSettings && value !== this.shellTheme)
this.userthemesSettings.set_string('name', value);
}
get useUserthemes() {
const extension = getUserthemesExtension();
return extension && extension.state === 1;
}
get iconTheme() {
return this.interfaceSettings.get_string('icon-theme');
}
set iconTheme(value) {
if (value !== this.iconTheme) {
this.interfaceSettings.set_string('icon-theme', value);
logDebug(`Icon theme has been set to '${value}'.`);
}
}
get cursorTheme() {
return this.interfaceSettings.get_string('cursor-theme');
}
set cursorTheme(value) {
if (value !== this.cursorTheme) {
this.interfaceSettings.set_string('cursor-theme', value);
logDebug(`Cursor theme has been set to '${value}'.`);
}
}
get background() {
return this.backgroundSettings.get_string('picture-uri');
}
set background(value) {
if (value !== this.background)
this.backgroundSettings.set_string('picture-uri', value);
}
_onNightlightStatusChanged(_settings, _changedKey) {
logDebug(`Night Light has been ${this.nightlightEnabled ? 'ena' : 'disa'}bled.`);
this.emit('nightlight-status-changed', this.nightlightEnabled);
}
_onLocationStatusChanged(_settings, _changedKey) {
logDebug(`Location has been ${this.locationEnabled ? 'ena' : 'disa'}bled.`);
this.emit('location-status-changed', this.locationEnabled);
}
_onGtkThemeChanged(_settings, _changedKey) {
logDebug(`GTK theme has changed to '${this.gtkTheme}'.`);
this.emit('gtk-theme-changed', this.gtkTheme);
}
_onShellThemeChanged(_settings, _changedKey) {
logDebug(`Shell theme has changed to '${this.shellTheme}'.`);
this.emit('shell-theme-changed', this.shellTheme);
}
_onIconThemeChanged(_settings, _changedKey) {
logDebug(`Cursor theme has changed to '${this.iconTheme}'.`);
this.emit('icon-theme-changed', this.iconTheme);
}
_onCursorThemeChanged(_settings, _changedKey) {
logDebug(`Cursor theme has changed to '${this.cursorTheme}'.`);
this.emit('cursor-theme-changed', this.cursorTheme);
}
_onBackgroundChanged(_settings, _changedKey) {
logDebug(`Background has changed to '${this.background}'.`);
this.emit('background-changed', this.background);
}
};
Signals.addSignalMethods(SystemSettings.prototype);
-167
View File
@@ -1,167 +0,0 @@
// SPDX-FileCopyrightText: 2020, 2021 Romain Vigier <contact AT romainvigier.fr>
// SPDX-License-Identifier: GPL-3.0-or-later
const { extensionUtils } = imports.misc;
const Signals = imports.signals;
const Me = extensionUtils.getCurrentExtension();
const { logDebug, getSettingsSchema } = Me.imports.utils;
var TimeSettings = class {
constructor() {
logDebug('Initializing time settings...');
this.settings = extensionUtils.getSettings(getSettingsSchema('time'));
logDebug('Time settings initialized.');
}
enable() {
logDebug('Connecting time settings signals...');
this._timeSourceChangedConnect = this.settings.connect('changed::time-source', this._onTimeSourceChanged.bind(this));
this._manualTimeSourceChangedConnect = this.settings.connect('changed::manual-time-source', this._onManualTimeSourceChanged.bind(this));
this._nightlightFollowDisableConnect = this.settings.connect('changed::nightlight-follow-disable', this._onNightlightFollowDisableChanged.bind(this));
this._alwaysEnableOndemandConnect = this.settings.connect('changed::always-enable-ondemand', this._onAlwaysEnableOndemandChanged.bind(this));
this._ondemandTimeChangedConnect = this.settings.connect('changed::ondemand-time', this._onOndemandTimeChanged.bind(this));
this._ondemandKeybindingChangedConnect = this.settings.connect('changed::nightthemeswitcher-ondemand-keybinding', this._onOndemandKeybindingChanged.bind(this));
this._ondemandButtonPlacementChangedConnect = this.settings.connect('changed::ondemand-button-placement', this._onOndemandButtonPlacementChanged.bind(this));
logDebug('System time signals connected.');
}
disable() {
logDebug('Disconnecting time settings signals...');
this.settings.disconnect(this._timeSourceChangedConnect);
this.settings.disconnect(this._manualTimeSourceChangedConnect);
this.settings.disconnect(this._nightlightFollowDisableConnect);
this.settings.disconnect(this._alwaysEnableOndemandConnect);
this.settings.disconnect(this._ondemandTimeChangedConnect);
this.settings.disconnect(this._ondemandKeybindingChangedConnect);
this.settings.disconnect(this._ondemandButtonPlacementChangedConnect);
logDebug('Time settings signals disconnected.');
}
get timeSource() {
return this.settings.get_string('time-source');
}
set timeSource(value) {
if (value !== this.timeSource) {
this.settings.set_string('time-source', value);
logDebug(`The time source has been set to ${value}.`);
}
}
get manualTimeSource() {
return this.settings.get_boolean('manual-time-source');
}
set manualTimeSource(value) {
if (value !== this.manualTimeSource)
this.settings.set_boolean('manual-time-source', value);
}
get nightlightFollowDisable() {
return this.settings.get_boolean('nightlight-follow-disable');
}
set nightlightFollowDisable(value) {
if (value !== this.nightlightFollowDisable)
this.settings.set_boolean('nightlight-follow-disable', value);
}
get alwaysEnableOndemand() {
return this.settings.get_boolean('always-enable-ondemand');
}
set alwaysEnableOndemand(value) {
if (value !== this.alwaysEnableOndemand)
this.settings.set_boolean('always-enable-ondemand', value);
}
get ondemandTime() {
return this.settings.get_string('ondemand-time');
}
set ondemandTime(value) {
if (value !== this.ondemandTime) {
this.settings.set_string('ondemand-time', value);
logDebug(`The on-demand time has been set to ${value}.`);
}
}
get ondemandKeybinding() {
return this.settings.get_strv('nightthemeswitcher-ondemand-keybinding')[0];
}
set ondemandKeybinding(keybinding) {
this.settings.set_strv('nightthemeswitcher-ondemand-keybinding', [keybinding]);
}
get ondemandButtonPlacement() {
return this.settings.get_string('ondemand-button-placement');
}
set ondemandButtonPlacement(value) {
if (value !== this.ondemandButtonPlacement)
this.settings.set_boolean('ondemand-button-placement', value);
}
get scheduleSunrise() {
return this.settings.get_double('schedule-sunrise');
}
set scheduleSunrise(value) {
if (value !== this.scheduleSunrise)
this.settings.set_double('schedule-sunrise', value);
}
get scheduleSunset() {
return this.settings.get_double('schedule-sunset');
}
set scheduleSunset(value) {
if (value !== this.scheduleSunset)
this.settings.set_double('schedule-sunset', value);
}
_onTimeSourceChanged(_settings, _changedKey) {
logDebug(`Time source has changed to ${this.timeSource}.`);
this.emit('time-source-changed', this.timeSource);
}
_onManualTimeSourceChanged(_settings, _changedKey) {
logDebug(`Manual time source has been ${this.manualTimeSource ? 'ena' : 'disa'}bled.`);
this.emit('manual-time-source-changed', this.manualTimeSource);
}
_onNightlightFollowDisableChanged(_settings, _changedKey) {
logDebug(`Follow Night Light "Disable until tomorrow" has been ${this.nightlightFollowDisable ? 'ena' : 'disa'}bled.`);
this.emit('nightlight-follow-disable-changed', this.nightlightFollowDisable);
}
_onAlwaysEnableOndemandChanged(_settings, _changedKey) {
logDebug(`Always enable on-demand timer has been ${this.alwaysEnableOndemand ? 'ena' : 'disa'}bled.`);
this.emit('always-enable-ondemand-changed', this.alwaysEnableOndemand);
}
_onOndemandTimeChanged(_settings, _changedKey) {
logDebug(`On-demand time has changed to ${this.ondemandTime}.`);
this.emit('ondemand-time-changed', this.ondemandTime);
}
_onOndemandKeybindingChanged(_settings, _changedKey) {
if (this.ondemandKeybinding)
logDebug(`On-demand keybinding has changed to ${this.ondemandKeybinding}.`);
else
logDebug('On-demand keybinding has been cleared.');
this.emit('ondemand-keybinding-changed', this.ondemandKeybinding);
}
_onOndemandButtonPlacementChanged(_settings, _changedKey) {
logDebug(`On-demand button placement has changed to ${this.ondemandButtonPlacement}`);
this.emit('ondemand-button-placement-changed', this.ondemandButtonPlacement);
}
};
Signals.addSignalMethods(TimeSettings.prototype);
-51
View File
@@ -1,51 +0,0 @@
// SPDX-FileCopyrightText: 2020, 2021 Romain Vigier <contact AT romainvigier.fr>
// SPDX-License-Identifier: GPL-3.0-or-later
const { extensionUtils } = imports.misc;
const Me = extensionUtils.getCurrentExtension();
const { getSettingsSchema } = Me.imports.utils;
/**
* Migrate settings from v0 to v1.
*
* @param {Settings} settings The current settings.
*/
function migrate(settings) {
const oldSettings = extensionUtils.getSettings(getSettingsSchema('v0'));
settings.gtkVariants.enabled = oldSettings.get_boolean('gtk-variants-enabled');
settings.gtkVariants.day = oldSettings.get_string('gtk-variant-day');
settings.gtkVariants.night = oldSettings.get_string('gtk-variant-night');
settings.gtkVariants.manual = oldSettings.get_boolean('manual-gtk-variants');
settings.shellVariants.enabled = oldSettings.get_boolean('shell-variants-enabled');
settings.shellVariants.day = oldSettings.get_string('shell-variant-day');
settings.shellVariants.night = oldSettings.get_string('shell-variant-night');
settings.shellVariants.manual = oldSettings.get_boolean('manual-shell-variants');
settings.iconVariants.enabled = oldSettings.get_boolean('icon-variants-enabled');
settings.iconVariants.day = oldSettings.get_string('icon-variant-day');
settings.iconVariants.night = oldSettings.get_string('icon-variant-night');
settings.cursorVariants.enabled = oldSettings.get_boolean('cursor-variants-enabled');
settings.cursorVariants.day = oldSettings.get_string('cursor-variant-day');
settings.cursorVariants.night = oldSettings.get_string('cursor-variant-night');
settings.commands.enabled = oldSettings.get_boolean('commands-enabled');
settings.commands.sunrise = oldSettings.get_string('command-sunrise');
settings.commands.sunset = oldSettings.get_string('command-sunset');
settings.backgrounds.enabled = oldSettings.get_boolean('backgrounds-enabled');
settings.backgrounds.day = oldSettings.get_string('background-day');
settings.backgrounds.night = oldSettings.get_string('background-night');
settings.time.timeSource = oldSettings.get_string('time-source');
settings.time.ondemandTime = oldSettings.get_string('ondemand-time');
settings.time.ondemandKeybinding = oldSettings.get_strv('nightthemeswitcher-ondemand-keybinding')[0];
settings.time.ondemandButtonPlacement = oldSettings.get_string('ondemand-button-placement');
settings.time.manualTimeSource = oldSettings.get_boolean('manual-time-source');
settings.time.scheduleSunrise = oldSettings.get_double('schedule-sunrise');
settings.time.scheduleSunset = oldSettings.get_double('schedule-sunset');
}