Split settings into different files

This commit is contained in:
Romain
2020-09-23 10:14:19 +00:00
parent 10c329c85c
commit 514690926c
30 changed files with 2121 additions and 1298 deletions
+1
View File
@@ -35,6 +35,7 @@ build: build-clean
--extra-source=./utils.js \
--extra-source=./modules/ \
--extra-source=./schemas/ \
--extra-source=./settings/ \
--podir=./po/ \
--gettext-domain=$(UUID) \
--out-dir=./build \
+16 -7
View File
@@ -39,18 +39,27 @@ function extensionManagerInitialized() {
function extensionManagerLookup(uuid) {
if (shellMinorVersion > 32)
return imports.ui.main.extensionManager.lookup(uuid);
try {
if (shellMinorVersion > 32)
return imports.ui.main.extensionManager.lookup(uuid);
else
return extensionUtils.extensions[uuid] || null;
} catch (_) {
return null;
}
}
function getSettings(schema) {
if (shellMinorVersion <= 30)
return Me.imports.convenience.getSettings(schema);
else
return extensionUtils.extensions[uuid] || null;
return extensionUtils.getSettings(schema);
}
function getExtensionSettings() {
if (shellMinorVersion <= 30)
return Me.imports.convenience.getSettings();
else
return extensionUtils.getSettings();
return getSettings();
}
+6 -6
View File
@@ -24,7 +24,7 @@ const Me = extensionUtils.getCurrentExtension();
const compat = Me.imports.compat;
const { logDebug } = Me.imports.utils;
const { SettingsManager } = Me.imports.modules.SettingsManager;
const { Settings } = Me.imports.settings.Settings;
const { Timer } = Me.imports.modules.Timer;
const { GtkThemer } = Me.imports.modules.GtkThemer;
const { ShellThemer } = Me.imports.modules.ShellThemer;
@@ -35,7 +35,7 @@ const { Commander } = Me.imports.modules.Commander;
var enabled = false;
var settingsManager = null;
var settings = null;
var timer = null;
var gtkThemer = null;
var shellThemer = null;
@@ -54,7 +54,7 @@ function init() {
function enable() {
_awaitExtensionManagerInit().then(() => {
logDebug('Enabling extension...');
settingsManager = new SettingsManager();
settings = new Settings();
timer = new Timer();
gtkThemer = new GtkThemer();
shellThemer = new ShellThemer();
@@ -63,7 +63,7 @@ function enable() {
backgrounder = new Backgrounder();
commander = new Commander();
settingsManager.enable();
settings.enable();
gtkThemer.enable();
shellThemer.enable();
iconThemer.enable();
@@ -88,9 +88,9 @@ function disable() {
backgrounder.disable();
commander.disable();
timer.disable();
settingsManager.disable();
settings.disable();
settingsManager = null;
settings = null;
timer = null;
gtkThemer = null;
shellThemer = null;
+36 -28
View File
@@ -33,16 +33,16 @@ const { logDebug } = Me.imports.utils;
var Backgrounder = class {
constructor() {
this._backgroundsStatusChangedConnect = null;
this._backgroundTimeChangedConnect = null;
this._statusChangedConnect = null;
this._backgroundChangedConnect = null;
this._systemBackgroundChangedConnect = null;
this._backgroundChangedConnect = null;
this._timeChangedConnect = null;
}
enable() {
logDebug('Enabling Backgrounder...');
this._watchStatus();
if (e.settingsManager.backgroundsEnabled) {
if (e.settings.backgrounds.enabled) {
this._connectSettings();
this._connectTimer();
}
@@ -60,76 +60,84 @@ var Backgrounder = class {
_watchStatus() {
logDebug('Watching backgrounds status...');
this._backgroundsStatusChangedConnect = e.settingsManager.connect('backgrounds-status-changed', this._onBackgroundsStatusChanged.bind(this));
this._statusChangedConnect = e.settings.backgrounds.connect('status-changed', this._onStatusChanged.bind(this));
}
_unwatchStatus() {
if (this._backgroundsStatusChangedConnect) {
e.settingsManager.disconnect(this._backgroundsStatusChangedConnect);
this._backgroundsStatusChangedConnect = null;
if (this._statusChangedConnect) {
e.settings.backgrounds.disconnect(this._statusChangedConnect);
this._statusChangedConnect = null;
}
logDebug('Stopped watching backgrounds status.');
}
_connectSettings() {
logDebug('Connecting Backgrounder to settings...');
this._backgroundTimeChangedConnect = e.settingsManager.connect('background-time-changed', this._onBackgroundTimeChanged.bind(this));
this._backgroundChangedConnect = e.settingsManager.connect('background-changed', this._onBackgroundChanged.bind(this));
this._backgroundChangedConnect = e.settings.backgrounds.connect('time-changed', this._onBackgroundChanged.bind(this));
this._systemBackgroundChangedConnect = e.settings.system.connect('background-changed', this._onSystemBackgroundChanged.bind(this));
}
_disconnectSettings() {
if (this._backgroundTimeChangedConnect) {
e.settingsManager.disconnect(this._backgroundTimeChangedConnect);
this._backgroundTimeChangedConnect = null;
}
if (this._backgroundChangedConnect) {
e.settingsManager.disconnect(this._backgroundChangedConnect);
e.settings.backgrounds.disconnect(this._backgroundChangedConnect);
this._backgroundChangedConnect = null;
}
if (this._systemBackgroundChangedConnect) {
e.settings.system.disconnect(this._systemBackgroundChangedConnect);
this._systemBackgroundChangedConnect = null;
}
logDebug('Disconnected Backgrounder from settings.');
}
_connectTimer() {
logDebug('Connecting Backgrounder to Timer...');
this._timeChangedConnect = e.timer.connect('time-changed', this._onTimeChanged.bind(this));
this._backgroundChangedConnect = e.timer.connect('time-changed', this._onTimeChanged.bind(this));
}
_disconnectTimer() {
if (this._timeChangedConnect) {
e.timer.disconnect(this._timeChangedConnect);
this._timeChangedConnect = null;
if (this._backgroundChangedConnect) {
e.timer.disconnect(this._backgroundChangedConnect);
this._backgroundChangedConnect = null;
}
logDebug('Disconnected Backgrounder from Timer.');
}
_onBackgroundsStatusChanged(_settings, _enabled) {
_onStatusChanged(_settings, _enabled) {
this.disable();
this.enable();
}
_onBackgroundTimeChanged(_settings, changedBackgroundTime) {
_onBackgroundChanged(_settings, changedBackgroundTime) {
if (changedBackgroundTime === e.timer.time)
this._changeBackground(changedBackgroundTime);
this._changeSystemBackground(changedBackgroundTime);
}
_onBackgroundChanged(_settings, newBackground) {
_onSystemBackgroundChanged(_settings, newBackground) {
switch (e.timer.time) {
case 'day':
e.settingsManager.backgroundDay = newBackground;
e.settings.backgrounds.day = newBackground;
break;
case 'night':
e.settingsManager.backgroundNight = newBackground;
e.settings.backgrounds.night = newBackground;
}
}
_onTimeChanged(_timer, newTime) {
this._changeBackground(newTime);
this._changeSystemBackground(newTime);
}
_changeBackground(time) {
e.settingsManager.background = time === 'day' ? e.settingsManager.backgroundDay : e.settingsManager.backgroundNight;
_changeSystemBackground(time) {
switch (time) {
case 'day':
if (e.settings.backgrounds.day)
e.settings.system.background = e.settings.backgrounds.day;
break;
case 'night':
if (e.settings.backgrounds.night)
e.settings.system.background = e.settings.backgrounds.night;
}
}
};
+8 -8
View File
@@ -31,14 +31,14 @@ const { logDebug } = Me.imports.utils;
var Commander = class {
constructor() {
this._commandsStatusChangedConnect = null;
this._statusChangedConnect = null;
this._timeChangedConnect = null;
}
enable() {
logDebug('Enabling Commander...');
this._watchStatus();
if (e.settingsManager.commandsEnabled)
if (e.settings.commands.enabled)
this._connectTimer();
logDebug('Commander enabled.');
}
@@ -53,13 +53,13 @@ var Commander = class {
_watchStatus() {
logDebug('Watching commands status...');
this._commandsStatusChangedConnect = e.settingsManager.connect('commands-status-changed', this._onCommandsStatusChanged.bind(this));
this._statusChangedConnect = e.settings.commands.connect('status-changed', this._onStatusChanged.bind(this));
}
_unwatchStatus() {
if (this._commandsStatusChangedConnect) {
e.settingsManager.disconnect(this._commandsStatusChangedConnect);
this._commandsStatusChangedConnect = null;
if (this._statusChangedConnect) {
e.settings.commands.disconnect(this._statusChangedConnect);
this._statusChangedConnect = null;
}
logDebug('Stopped watching commands status.');
}
@@ -78,7 +78,7 @@ var Commander = class {
}
_onCommandsStatusChanged(_settings, _enabled) {
_onStatusChanged(_settings, _enabled) {
this.disable();
this.enable();
}
@@ -89,7 +89,7 @@ var Commander = class {
_spawnCommand(time) {
const command = time === 'day' ? e.settingsManager.commandSunrise : e.settingsManager.commandSunset;
const command = time === 'day' ? e.settings.commands.sunrise : e.settings.commands.sunset;
GLib.spawn_async(null, ['sh', '-c', command], null, GLib.SpawnFlags.SEARCH_PATH, null);
logDebug(`Spawned ${time} command.`);
}
+34 -26
View File
@@ -32,16 +32,16 @@ const { logDebug } = Me.imports.utils;
var CursorThemer = class {
constructor() {
this._cursorVariantsStatusChangedConnect = null;
this._cursorVariantChangedConnect = null;
this._cursorThemeChangedConnect = null;
this._statusChangedConnect = null;
this._variantChangedConnect = null;
this._systemCursorThemeChangedConnect = null;
this._timeChangedConnect = null;
}
enable() {
logDebug('Enabling Cursor Themer...');
this._watchStatus();
if (e.settingsManager.cursorVariantsEnabled) {
if (e.settings.cursorVariants.enabled) {
this._connectSettings();
this._connectTimer();
}
@@ -59,31 +59,31 @@ var CursorThemer = class {
_watchStatus() {
logDebug('Watching cursor variants status...');
this._cursorVariantsStatusChangedConnect = e.settingsManager.connect('cursor-variants-status-changed', this._onCursorVariantsStatusChanged.bind(this));
this._statusChangedConnect = e.settings.cursorVariants.connect('status-changed', this._onStatusChanged.bind(this));
}
_unwatchStatus() {
if (this._cursorVariantsStatusChangedConnect) {
e.settingsManager.disconnect(this._cursorVariantsStatusChangedConnect);
this._cursorVariantsStatusChangedConnect = null;
if (this._statusChangedConnect) {
e.settings.cursorVariants.disconnect(this._statusChangedConnect);
this._statusChangedConnect = null;
}
logDebug('Stopped watching cursor variants status.');
}
_connectSettings() {
logDebug('Connecting Cursor Themer to settings...');
this._cursorVariantChangedConnect = e.settingsManager.connect('cursor-variant-changed', this._onCursorVariantChanged.bind(this));
this._cursorThemeChangedConnect = e.settingsManager.connect('cursor-theme-changed', this._onCursorThemeChanged.bind(this));
this._variantChangedConnect = e.settings.cursorVariants.connect('variant-changed', this._onVariantChanged.bind(this));
this._systemCursorThemeChangedConnect = e.settings.system.connect('cursor-theme-changed', this._onSystemCursorThemeChanged.bind(this));
}
_disconnectSettings() {
if (this._cursorVariantChangedConnect) {
e.settingsManager.disconnect(this._cursorVariantChangedConnect);
this._cursorVariantChangedConnect = null;
if (this._variantChangedConnect) {
e.settings.cursorVariants.disconnect(this._variantChangedConnect);
this._variantChangedConnect = null;
}
if (this._cursorThemeChangedConnect) {
e.settingsManager.disconnect(this._cursorThemeChangedConnect);
this._cursorThemeChangedConnect = null;
if (this._systemCursorThemeChangedConnect) {
e.settings.system.disconnect(this._systemCursorThemeChangedConnect);
this._systemCursorThemeChangedConnect = null;
}
logDebug('Disconnected Cursor Themer from settings.');
}
@@ -102,35 +102,43 @@ var CursorThemer = class {
}
_onCursorVariantsStatusChanged(_settings, _enabled) {
_onStatusChanged(_settings, _enabled) {
this.disable();
this.enable();
}
_onCursorVariantChanged(_settings, changedVariantTime) {
_onVariantChanged(_settings, changedVariantTime) {
if (changedVariantTime === e.timer.time)
this._setVariant(changedVariantTime);
this._setSystemVariant(changedVariantTime);
}
_onCursorThemeChanged(_settings, newTheme) {
_onSystemCursorThemeChanged(_settings, newTheme) {
switch (e.timer.time) {
case 'day':
e.settingsManager.cursorVariantDay = newTheme;
e.settings.cursorVariants.day = newTheme;
break;
case 'night':
e.settingsManager.cursorVariantNight = newTheme;
e.settings.cursorVariants.night = newTheme;
}
this._setVariant(e.timer.time);
this._setSystemVariant(e.timer.time);
}
_onTimeChanged(_timer, newTime) {
this._setVariant(newTime);
this._setSystemVariant(newTime);
}
_setVariant(time) {
_setSystemVariant(time) {
logDebug(`Setting the cursor ${time} variant...`);
e.settingsManager.cursorTheme = time === 'day' ? e.settingsManager.cursorVariantDay : e.settingsManager.cursorVariantNight;
switch (time) {
case 'day':
if (e.settings.cursorVariants.day)
e.settings.system.cursorTheme = e.settings.cursorVariants.day;
break;
case 'night':
if (e.settings.cursorVariants.night)
e.settings.system.cursorTheme = e.settings.cursorVariants.night;
}
}
};
+37 -33
View File
@@ -43,10 +43,10 @@ const _ = Gettext.gettext;
var GtkThemer = class {
constructor() {
this._gtkVariantsStatusChangedConnect = null;
this._gtkVariantChangedConnect = null;
this._gtkThemeChangedConnect = null;
this._manualGtkVariantsChangedConnect = null;
this._statusChangedConnect = null;
this._variantChangedConnect = null;
this._manualChangedConnect = null;
this._systemGtkThemeChangedConnect = null;
this._timeChangedConnect = null;
}
@@ -54,7 +54,7 @@ var GtkThemer = class {
logDebug('Enabling GTK Themer...');
try {
this._watchStatus();
if (e.settingsManager.gtkVariantsEnabled) {
if (e.settings.gtkVariants.enabled) {
this._connectSettings();
this._updateVariants();
this._connectTimer();
@@ -76,32 +76,36 @@ var GtkThemer = class {
_watchStatus() {
logDebug('Watching GTK variants status...');
this._gtkVariantsStatusChangedConnect = e.settingsManager.connect('gtk-variants-status-changed', this._onGtkVariantsStatusChanged.bind(this));
this._statusChangedConnect = e.settings.gtkVariants.connect('status-changed', this._onStatusChanged.bind(this));
}
_unwatchStatus() {
if (this._gtkVariantsStatusChangedConnect) {
e.settingsManager.disconnect(this._gtkVariantsStatusChangedConnect);
this._gtkVariantsStatusChangedConnect = null;
if (this._statusChangedConnect) {
e.settings.gtkVariants.disconnect(this._statusChangedConnect);
this._statusChangedConnect = null;
}
logDebug('Stopped watching GTK variants status.');
}
_connectSettings() {
logDebug('Connecting GTK Themer to settings...');
this._gtkVariantChangedConnect = e.settingsManager.connect('gtk-variant-changed', this._onGtkVariantChanged.bind(this));
this._gtkThemeChangedConnect = e.settingsManager.connect('gtk-theme-changed', this._onGtkThemeChanged.bind(this));
this._manualGtkVariantsChangedConnect = e.settingsManager.connect('manual-gtk-variants-changed', this._onManualGtkVariantsChanged.bind(this));
this._variantChangedConnect = e.settings.gtkVariants.connect('variant-changed', this._onVariantChanged.bind(this));
this._manualChangedConnect = e.settings.gtkVariants.connect('manual-changed', this._onManualChanged.bind(this));
this._systemGtkThemeChangedConnect = e.settings.system.connect('gtk-theme-changed', this._onSystemGtkThemeChanged.bind(this));
}
_disconnectSettings() {
if (this._gtkVariantChangedConnect) {
e.settingsManager.disconnect(this._gtkVariantChangedConnect);
this._gtkVariantChangedConnect = null;
if (this._variantChangedConnect) {
e.settings.gtkVariants.disconnect(this._variantChangedConnect);
this._variantChangedConnect = null;
}
if (this._gtkThemeChangedConnect) {
e.settingsManager.disconnect(this._gtkThemeChangedConnect);
this._gtkThemeChangedConnect = 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.');
}
@@ -120,54 +124,54 @@ var GtkThemer = class {
}
_onGtkVariantsStatusChanged(_settings, _enabled) {
_onStatusChanged(_settings, _enabled) {
this.disable();
this.enable();
}
_onGtkVariantChanged(_settings, changedVariantTime) {
_onVariantChanged(_settings, changedVariantTime) {
if (changedVariantTime === e.timer.time)
this._setVariant(changedVariantTime);
this._setSystemVariant(changedVariantTime);
}
_onGtkThemeChanged(_settings, _newTheme) {
_onSystemGtkThemeChanged(_settings, _newTheme) {
try {
this._updateVariants();
this._setVariant(e.timer.time);
this._setSystemVariant(e.timer.time);
} catch (error) {
notifyError(error);
}
}
_onManualGtkVariantsChanged(_settings, enabled) {
_onManualChanged(_settings, enabled) {
this.disable();
this.enable();
if (enabled)
this._setVariant(e.timer.time);
this._setSystemVariant(e.timer.time);
}
_onTimeChanged(_timer, newTime) {
this._setVariant(newTime);
this._setSystemVariant(newTime);
}
_areVariantsUpToDate() {
return e.settingsManager.gtkTheme === e.settingsManager.gtkVariantDay || e.settingsManager.gtkTheme === e.settingsManager.gtkVariantNight;
return e.settings.system.gtkTheme === e.settings.gtkVariants.day || e.settings.system.gtkTheme === e.settings.gtkVariants.night;
}
_setVariant(time) {
_setSystemVariant(time) {
if (!time)
return;
logDebug(`Setting the GTK ${time} variant...`);
e.settingsManager.gtkTheme = time === 'day' ? e.settingsManager.gtkVariantDay : e.settingsManager.gtkVariantNight;
e.settings.system.gtkTheme = time === 'day' ? e.settings.gtkVariants.day : e.settings.gtkVariants.night;
}
_updateVariants() {
if (e.settingsManager.manualGtkVariants || this._areVariantsUpToDate())
if (e.settings.gtkVariants.manual || this._areVariantsUpToDate())
return;
logDebug('Updating GTK variants...');
const originalTheme = e.settingsManager.gtkTheme;
const originalTheme = e.settings.system.gtkTheme;
const variants = GtkVariants.guessFrom(originalTheme);
const installedThemes = getInstalledGtkThemes();
@@ -176,8 +180,8 @@ var GtkThemer = class {
throw new Error(message);
}
e.settingsManager.gtkVariantDay = variants.get('day');
e.settingsManager.gtkVariantNight = variants.get('night');
e.settings.gtkVariants.day = variants.get('day');
e.settings.gtkVariants.night = variants.get('night');
logDebug(`New GTK variants. { day: '${variants.get('day')}'; night: '${variants.get('night')}' }`);
}
+34 -26
View File
@@ -32,16 +32,16 @@ const { logDebug } = Me.imports.utils;
var IconThemer = class {
constructor() {
this._iconVariantsStatusChangedConnect = null;
this._iconVariantChangedConnect = null;
this._iconThemeChangedConnect = null;
this._statusChangedConnect = null;
this._variantChangedConnect = null;
this._systemIconThemeChangedConnect = null;
this._timeChangedConnect = null;
}
enable() {
logDebug('Enabling Icon Themer...');
this._watchStatus();
if (e.settingsManager.iconVariantsEnabled) {
if (e.settings.iconVariants.enabled) {
this._connectSettings();
this._connectTimer();
}
@@ -59,31 +59,31 @@ var IconThemer = class {
_watchStatus() {
logDebug('Watching icon variants status...');
this._iconVariantsStatusChangedConnect = e.settingsManager.connect('icon-variants-status-changed', this._onIconVariantsStatusChanged.bind(this));
this._statusChangedConnect = e.settings.iconVariants.connect('status-changed', this._onStatusChanged.bind(this));
}
_unwatchStatus() {
if (this._iconVariantsStatusChangedConnect) {
e.settingsManager.disconnect(this._iconVariantsStatusChangedConnect);
this._iconVariantsStatusChangedConnect = null;
if (this._statusChangedConnect) {
e.settings.iconVariants.disconnect(this._statusChangedConnect);
this._statusChangedConnect = null;
}
logDebug('Stopped watching icon variants status.');
}
_connectSettings() {
logDebug('Connecting Icon Themer to settings...');
this._iconVariantChangedConnect = e.settingsManager.connect('icon-variant-changed', this._onIconVariantChanged.bind(this));
this._iconThemeChangedConnect = e.settingsManager.connect('icon-theme-changed', this._onIconThemeChanged.bind(this));
this._variantChangedConnect = e.settings.iconVariants.connect('variant-changed', this._onVariantChanged.bind(this));
this._systemIconThemeChangedConnect = e.settings.system.connect('icon-theme-changed', this._onSystemIconThemeChanged.bind(this));
}
_disconnectSettings() {
if (this._iconVariantChangedConnect) {
e.settingsManager.disconnect(this._iconVariantChangedConnect);
this._iconVariantChangedConnect = null;
if (this._variantChangedConnect) {
e.settings.iconVariants.disconnect(this._variantChangedConnect);
this._variantChangedConnect = null;
}
if (this._iconThemeChangedConnect) {
e.settingsManager.disconnect(this._iconThemeChangedConnect);
this._iconThemeChangedConnect = null;
if (this._systemIconThemeChangedConnect) {
e.settings.system.disconnect(this._systemIconThemeChangedConnect);
this._systemIconThemeChangedConnect = null;
}
logDebug('Disconnected Icon Themer from settings.');
}
@@ -102,35 +102,43 @@ var IconThemer = class {
}
_onIconVariantsStatusChanged(_settings, _enabled) {
_onStatusChanged(_settings, _enabled) {
this.disable();
this.enable();
}
_onIconVariantChanged(_settings, changedVariantTime) {
_onVariantChanged(_settings, changedVariantTime) {
if (changedVariantTime === e.timer.time)
this._setVariant(changedVariantTime);
this._setSystemVariant(changedVariantTime);
}
_onIconThemeChanged(_settings, newTheme) {
_onSystemIconThemeChanged(_settings, newTheme) {
switch (e.timer.time) {
case 'day':
e.settingsManager.iconVariantDay = newTheme;
e.settings.iconVariants.day = newTheme;
break;
case 'night':
e.settingsManager.iconVariantNight = newTheme;
e.settings.iconVariants.night = newTheme;
}
this._setVariant(e.timer.time);
this._setSystemVariant(e.timer.time);
}
_onTimeChanged(_timer, newTime) {
this._setVariant(newTime);
this._setSystemVariant(newTime);
}
_setVariant(time) {
_setSystemVariant(time) {
logDebug(`Setting the icon ${time} variant...`);
e.settingsManager.iconTheme = time === 'day' ? e.settingsManager.iconVariantDay : e.settingsManager.iconVariantNight;
switch (time) {
case 'day':
if (e.settings.iconVariants.day)
e.settings.system.iconTheme = e.settings.iconVariants.day;
break;
case 'night':
if (e.settings.iconVariants.night)
e.settings.system.iconTheme = e.settings.iconVariants.night;
}
}
};
-607
View File
@@ -1,607 +0,0 @@
/*
Night Theme Switcher Gnome Shell extension
Copyright (C) 2020 Romain Vigier
This program is free software: you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation, either version 3 of the License, or (at your option) any later
version.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
this program. If not, see <http s ://www.gnu.org/licenses/>.
*/
const { Gio } = imports.gi;
const { extensionUtils } = imports.misc;
const Signals = imports.signals;
const Me = extensionUtils.getCurrentExtension();
const compat = Me.imports.compat;
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 SettingsManager = class {
constructor() {
logDebug('Initializing settings...');
this._extensionsSettings = compat.getExtensionSettings();
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('Settings initialized.');
}
enable() {
logDebug('Connecting settings signals...');
this._gtkVariantsStatusChangedConnect = this._extensionsSettings.connect('changed::gtk-variants-enabled', this._onGtkVariantsStatusChanged.bind(this));
this._gtkVariantDayChangedConnect = this._extensionsSettings.connect('changed::gtk-variant-day', this._onGtkVariantDayChanged.bind(this));
this._gtkVariantNightChangedConnect = this._extensionsSettings.connect('changed::gtk-variant-night', this._onGtkVariantNightChanged.bind(this));
this._manualGtkVariantsChangedConnect = this._extensionsSettings.connect('changed::manual-gtk-variants', this._onManualGtkVariantsChanged.bind(this));
this._shellVariantsStatusChangedConnect = this._extensionsSettings.connect('changed::shell-variants-enabled', this._onShellVariantsStatusChanged.bind(this));
this._shellVariantDayChangedConnect = this._extensionsSettings.connect('changed::shell-variant-day', this._onShellVariantDayChanged.bind(this));
this._shellVariantNightChangedConnect = this._extensionsSettings.connect('changed::shell-variant-night', this._onShellVariantNightChanged.bind(this));
this._manualShellVariantsChangedConnect = this._extensionsSettings.connect('changed::manual-shell-variants', this._onManualShellVariantsChanged.bind(this));
this._iconVariantsStatusConnect = this._extensionsSettings.connect('changed::icon-variants-enabled', this._onIconVariantsStatusChanged.bind(this));
this._iconVariantDayChangedConnect = this._extensionsSettings.connect('changed::icon-variant-day', this._onIconVariantDayChanged.bind(this));
this._iconVariantNightChangedConnect = this._extensionsSettings.connect('changed::icon-variant-night', this._onIconVariantNightChanged.bind(this));
this._cursorVariantsStatusConnect = this._extensionsSettings.connect('changed::cursor-variants-enabled', this._onCursorVariantsStatusChanged.bind(this));
this._cursorVariantDayChangedConnect = this._extensionsSettings.connect('changed::cursor-variant-day', this._onCursorVariantDayChanged.bind(this));
this._cursorVariantNightChangedConnect = this._extensionsSettings.connect('changed::cursor-variant-night', this._onCursorVariantNightChanged.bind(this));
this._timeSourceChangedConnect = this._extensionsSettings.connect('changed::time-source', this._onTimeSourceChanged.bind(this));
this._manualTimeSourceChangedConnect = this._extensionsSettings.connect('changed::manual-time-source', this._onManualTimeSourceChanged.bind(this));
this._ondemandKeybindingChangedConnect = this._extensionsSettings.connect('changed::nightthemeswitcher-ondemand-keybinding', this._onOndemandKeybindingChanged.bind(this));
this._ondemandButtonPlacementChangedConnect = this._extensionsSettings.connect('changed::ondemand-button-placement', this._onOndemandButtonPlacementChanged.bind(this));
this._commandsStatusConnect = this._extensionsSettings.connect('changed::commands-enabled', this._onCommandsStatusChanged.bind(this));
this._backgroundsStatusConnect = this._extensionsSettings.connect('changed::backgrounds-enabled', this._onBackgroundsStatusChanged.bind(this));
this._backgroundDayChangedConnect = this._extensionsSettings.connect('changed::background-day', this._onBackgroundDayChanged.bind(this));
this._backgroundNightChangedConnect = this._extensionsSettings.connect('changed::background-night', this._onBackgroundNightChanged.bind(this));
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('Settings signals connected.');
}
disable() {
logDebug('Disconnecting settings signals...');
this._extensionsSettings.disconnect(this._gtkVariantsStatusChangedConnect);
this._extensionsSettings.disconnect(this._gtkVariantDayChangedConnect);
this._extensionsSettings.disconnect(this._gtkVariantNightChangedConnect);
this._extensionsSettings.disconnect(this._manualGtkVariantsChangedConnect);
this._extensionsSettings.disconnect(this._shellVariantsStatusChangedConnect);
this._extensionsSettings.disconnect(this._shellVariantDayChangedConnect);
this._extensionsSettings.disconnect(this._shellVariantNightChangedConnect);
this._extensionsSettings.disconnect(this._manualShellVariantsChangedConnect);
this._extensionsSettings.disconnect(this._iconVariantsStatusConnect);
this._extensionsSettings.disconnect(this._iconVariantDayChangedConnect);
this._extensionsSettings.disconnect(this._iconVariantNightChangedConnect);
this._extensionsSettings.disconnect(this._cursorVariantsStatusConnect);
this._extensionsSettings.disconnect(this._cursorVariantDayChangedConnect);
this._extensionsSettings.disconnect(this._cursorVariantNightChangedConnect);
this._extensionsSettings.disconnect(this._timeSourceChangedConnect);
this._extensionsSettings.disconnect(this._manualTimeSourceChangedConnect);
this._extensionsSettings.disconnect(this._ondemandKeybindingChangedConnect);
this._extensionsSettings.disconnect(this._ondemandButtonPlacementChangedConnect);
this._extensionsSettings.disconnect(this._commandsStatusConnect);
this._extensionsSettings.disconnect(this._backgroundsStatusConnect);
this._extensionsSettings.disconnect(this._backgroundDayChangedConnect);
this._extensionsSettings.disconnect(this._backgroundNightChangedConnect);
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('Settings signals disconnected.');
}
/**
* SETTERS AND GETTERS
*/
/* GTK variants settings */
get gtkVariantsEnabled() {
return this._extensionsSettings.get_boolean('gtk-variants-enabled');
}
get gtkVariantDay() {
return this._extensionsSettings.get_string('gtk-variant-day');
}
set gtkVariantDay(value) {
if (value !== this.gtkVariantDay) {
this._extensionsSettings.set_string('gtk-variant-day', value);
logDebug(`The GTK day variant has been set to '${value}'.`);
}
}
get gtkVariantNight() {
return this._extensionsSettings.get_string('gtk-variant-night');
}
set gtkVariantNight(value) {
if (value !== this.gtkVariantNight) {
this._extensionsSettings.set_string('gtk-variant-night', value);
logDebug(`The GTK night variant has been set to '${value}'.`);
}
}
get manualGtkVariants() {
return this._extensionsSettings.get_boolean('manual-gtk-variants');
}
/* Shell variants settings */
get shellVariantsEnabled() {
return this._extensionsSettings.get_boolean('shell-variants-enabled');
}
get shellVariantDay() {
return this._extensionsSettings.get_string('shell-variant-day');
}
set shellVariantDay(value) {
if (value !== this.shellVariantDay) {
this._extensionsSettings.set_string('shell-variant-day', value);
logDebug(`The shell day variant has been set to '${value}'.`);
}
}
get shellVariantNight() {
return this._extensionsSettings.get_string('shell-variant-night');
}
set shellVariantNight(value) {
if (value !== this.shellVariantNight) {
this._extensionsSettings.set_string('shell-variant-night', value);
logDebug(`The shell night variant has been set to '${value}'.`);
}
}
get manualShellVariants() {
return this._extensionsSettings.get_boolean('manual-shell-variants');
}
/* Cursor variants settings */
get cursorVariantsEnabled() {
return this._extensionsSettings.get_boolean('cursor-variants-enabled');
}
get cursorVariantDay() {
return this._extensionsSettings.get_string('cursor-variant-day') || this.cursorTheme;
}
set cursorVariantDay(value) {
if (value !== this.cursorVariantDay) {
this._extensionsSettings.set_string('cursor-variant-day', value);
logDebug(`The cursor day variant has been set to '${value}'.`);
}
}
get cursorVariantNight() {
return this._extensionsSettings.get_string('cursor-variant-night') || this.cursorTheme;
}
set cursorVariantNight(value) {
if (value !== this.cursorVariantNight) {
this._extensionsSettings.set_string('cursor-variant-night', value);
logDebug(`The cursor night variant has been set to '${value}'.`);
}
}
/* Icon variants settings */
get iconVariantsEnabled() {
return this._extensionsSettings.get_boolean('icon-variants-enabled');
}
get iconVariantDay() {
return this._extensionsSettings.get_string('icon-variant-day') || this.iconTheme;
}
set iconVariantDay(value) {
if (value !== this.iconVariantDay) {
this._extensionsSettings.set_string('icon-variant-day', value);
logDebug(`The icon day variant has been set to '${value}'.`);
}
}
get iconVariantNight() {
return this._extensionsSettings.get_string('icon-variant-night') || this.iconTheme;
}
set iconVariantNight(value) {
if (value !== this.iconVariantNight) {
this._extensionsSettings.set_string('icon-variant-night', value);
logDebug(`The icon night variant has been set to '${value}'.`);
}
}
/* Time source settings */
get timeSource() {
return this._extensionsSettings.get_string('time-source');
}
set timeSource(value) {
if (value !== this.timeSource) {
this._extensionsSettings.set_string('time-source', value);
logDebug(`The time source has been set to ${value}.`);
}
}
get manualTimeSource() {
return this._extensionsSettings.get_boolean('manual-time-source');
}
get ondemandTime() {
return this._extensionsSettings.get_string('ondemand-time');
}
set ondemandTime(value) {
if (value !== this.ondemandTime) {
this._extensionsSettings.set_string('ondemand-time', value);
logDebug(`The on-demand time has been set to ${value}.`);
}
}
get ondemandKeybinding() {
return this._extensionsSettings.get_strv('nightthemeswitcher-ondemand-keybinding')[0];
}
get ondemandButtonPlacement() {
return this._extensionsSettings.get_string('ondemand-button-placement');
}
get scheduleSunrise() {
return this._extensionsSettings.get_double('schedule-sunrise');
}
get scheduleSunset() {
return this._extensionsSettings.get_double('schedule-sunset');
}
/* Commands settings */
get commandsEnabled() {
return this._extensionsSettings.get_boolean('commands-enabled');
}
get commandSunrise() {
return this._extensionsSettings.get_string('command-sunrise');
}
get commandSunset() {
return this._extensionsSettings.get_string('command-sunset');
}
/* Background settings */
get backgroundsEnabled() {
return this._extensionsSettings.get_boolean('backgrounds-enabled');
}
get backgroundDay() {
return this._extensionsSettings.get_string('background-day') || this.background;
}
set backgroundDay(value) {
this._extensionsSettings.set_string('background-day', value);
}
get backgroundNight() {
return this._extensionsSettings.get_string('background-night') || this.background;
}
set backgroundNight(value) {
this._extensionsSettings.set_string('background-night', value);
}
/* Night Light settings */
get nightlightEnabled() {
return this._colorSettings.get_boolean('night-light-enabled');
}
/* Location settings */
get locationEnabled() {
return this._locationSettings.get_boolean('enabled');
}
/* GTK theme settings */
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}'.`);
}
}
/* Shell theme settings */
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;
}
/* Icon theme settings */
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}'.`);
}
}
/* Cursor theme settings */
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}'.`);
}
}
/* Background settings */
get background() {
return this._backgroundSettings.get_string('picture-uri');
}
set background(value) {
if (value !== this.background)
this._backgroundSettings.set_string('picture-uri', value);
}
/**
* SIGNALS
*/
/* GTK variants */
_onGtkVariantsStatusChanged(_settings, _changedKey) {
logDebug(`GTK variants have been ${this.gtkVariantsEnabled ? 'ena' : 'disa'}bled.`);
this.emit('gtk-variants-status-changed', this.gtkVariantsEnabled);
}
_onGtkVariantDayChanged(_settings, _changedKey) {
logDebug(`GTK day variant has changed to '${this.gtkVariantDay}'.`);
this.emit('gtk-variant-changed', 'day');
}
_onGtkVariantNightChanged(_settings, _changedKey) {
logDebug(`GTK night variant has changed to '${this.gtkVariantNight}'.`);
this.emit('gtk-variant-changed', 'night');
}
_onManualGtkVariantsChanged(_settings, _changedKey) {
logDebug(`Manual GTK variants have been ${this.manualGtkVariants ? 'ena' : 'disa'}bled.`);
this.emit('manual-gtk-variants-changed', this.manualGtkVariants);
}
/* Shell variants */
_onShellVariantsStatusChanged(_settings, _changedKey) {
logDebug(`Shell variants have been ${this.shellVariantsEnabled ? 'ena' : 'disa'}bled.`);
this.emit('shell-variants-status-changed', this.shellVariantsEnabled);
}
_onShellVariantDayChanged(_settings, _changedKey) {
logDebug(`Shell day variant has changed to '${this.shellVariantDay}'.`);
this.emit('shell-variant-changed', 'day');
}
_onShellVariantNightChanged(_settings, _changedKey) {
logDebug(`Shell night variant has changed to '${this.shellVariantNight}'.`);
this.emit('shell-variant-changed', 'night');
}
_onManualShellVariantsChanged(_settings, _changedKey) {
logDebug(`Manual Shell variants have been ${this.manualShellVariants ? 'ena' : 'disa'}bled.`);
this.emit('manual-shell-variants-changed', this.manualShellVariants);
}
/* Cursor variants */
_onCursorVariantsStatusChanged(_settings, _changedKey) {
logDebug(`Cursor variants have been ${this.cursorVariantsEnabled ? 'ena' : 'disa'}bled.`);
this.emit('cursor-variants-status-changed', this.cursorVariantsEnabled);
}
_onCursorVariantDayChanged(_settings, _changedKey) {
logDebug(`Cursor day variant has changed to '${this.cursorVariantDay}'.`);
this.emit('cursor-variant-changed', 'day');
}
_onCursorVariantNightChanged(_settings, _changedKey) {
logDebug(`Cursor night variant has changed to '${this.cursorVariantNight}'.`);
this.emit('cursor-variant-changed', 'night');
}
/* Icon variants */
_onIconVariantsStatusChanged(_settings, _changedKey) {
logDebug(`Icon variants have been ${this.iconVariantsEnabled ? 'ena' : 'disa'}bled.`);
this.emit('icon-variants-status-changed', this.iconVariantsEnabled);
}
_onIconVariantDayChanged(_settings, _changedKey) {
logDebug(`Icon day variant has changed to '${this.iconVariantDay}'.`);
this.emit('icon-variant-changed', 'day');
}
_onIconVariantNightChanged(_settings, _changedKey) {
logDebug(`Icon night variant has changed to '${this.iconVariantNight}'.`);
this.emit('icon-variant-changed', 'night');
}
/* Time source */
_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);
}
_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);
}
/* Commands */
_onCommandsStatusChanged(_settings, _changedKey) {
logDebug(`Commands have been ${this.commandsEnabled ? 'ena' : 'disa'}bled.`);
this.emit('commands-status-changed', this.commandsEnabled);
}
/* Backgrounds */
_onBackgroundsStatusChanged(_settings, _changedKey) {
logDebug(`Backgrounds have been ${this.backgroundsEnabled ? 'ena' : 'disa'}bled.`);
this.emit('backgrounds-status-changed', this.backgroundsEnabled);
}
_onBackgroundDayChanged(_settings, _changedKey) {
logDebug(`Day background has changed to '${this.backgroundDay}'.`);
this.emit('background-time-changed', 'day');
}
_onBackgroundNightChanged(_settings, _changedKey) {
logDebug(`Night background has changed to '${this.backgroundNight}'.`);
this.emit('background-time-changed', 'night');
}
/* Night Light */
_onNightlightStatusChanged(_settings, _changedKey) {
logDebug(`Night Light has been ${this.nightlightEnabled ? 'ena' : 'disa'}bled.`);
this.emit('nightlight-status-changed', this.nightlightEnabled);
}
/* Location */
_onLocationStatusChanged(_settings, _changedKey) {
logDebug(`Location has been ${this.locationEnabled ? 'ena' : 'disa'}bled.`);
this.emit('location-status-changed', this.locationEnabled);
}
/* GTK theme */
_onGtkThemeChanged(_settings, _changedKey) {
logDebug(`GTK theme has changed to '${this.gtkTheme}'.`);
this.emit('gtk-theme-changed', this.gtkTheme);
}
/* Icon theme */
_onIconThemeChanged(_settings, _changedKey) {
logDebug(`Cursor theme has changed to '${this.iconTheme}'.`);
this.emit('icon-theme-changed', this.iconTheme);
}
/* Cursor theme */
_onCursorThemeChanged(_settings, _changedKey) {
logDebug(`Cursor theme has changed to '${this.cursorTheme}'.`);
this.emit('cursor-theme-changed', this.cursorTheme);
}
/* Background */
_onBackgroundChanged(_settings, _changedKey) {
logDebug(`Background has changed to '${this.background}'.`);
this.emit('background-changed', this.background);
}
/* Shell theme */
_onShellThemeChanged(_settings, _changedKey) {
logDebug(`Shell theme has changed to '${this.shellTheme}'.`);
this.emit('shell-theme-changed', this.shellTheme);
}
};
Signals.addSignalMethods(SettingsManager.prototype);
+39 -35
View File
@@ -43,10 +43,10 @@ const _ = Gettext.gettext;
var ShellThemer = class {
constructor() {
this._shellVariantsStatusChangedConnect = null;
this._shellVariantChangedConnect = null;
this._shellThemeChangedConnect = null;
this._manualShellVariantsChangedConnect = null;
this._statusChangedConnect = null;
this._variantChangedConnect = null;
this._manualChangedConnect = null;
this._systemShellThemeChangedConnect = null;
this._timeChangedConnect = null;
}
@@ -54,7 +54,7 @@ var ShellThemer = class {
logDebug('Enabling Shell Themer...');
try {
this._watchStatus();
if (e.settingsManager.shellVariantsEnabled) {
if (e.settings.shellVariants.enabled) {
this._connectSettings();
this._updateVariants();
this._connectTimer();
@@ -76,32 +76,36 @@ var ShellThemer = class {
_watchStatus() {
logDebug('Watching shell variants status...');
this._shellVariantsStatusChangedConnect = e.settingsManager.connect('shell-variants-status-changed', this._onShellVariantsStatusChanged.bind(this));
this._statusChangedConnect = e.settings.shellVariants.connect('status-changed', this._onStatusChanged.bind(this));
}
_unwatchStatus() {
if (this._shellVariantsStatusChangedConnect) {
e.settingsManager.disconnect(this._shellVariantsStatusChangedConnect);
this._shellVariantsStatusChangedConnect = null;
if (this._statusChangedConnect) {
e.settings.shellVariants.disconnect(this._statusChangedConnect);
this._statusChangedConnect = null;
}
logDebug('Stopped watching shell variants status.');
}
_connectSettings() {
logDebug('Connecting Shell Themer to settings...');
this._shellVariantChangedConnect = e.settingsManager.connect('shell-variant-changed', this._onShellVariantChanged.bind(this));
this._shellThemeChangedConnect = e.settingsManager.connect('shell-theme-changed', this._onShellThemeChanged.bind(this));
this._manualShellVariantsChangedConnect = e.settingsManager.connect('manual-shell-variants-changed', this._onManualShellVariantsChanged.bind(this));
this._variantChangedConnect = e.settings.shellVariants.connect('variant-changed', this._onVariantChanged.bind(this));
this._manualChangedConnect = e.settings.shellVariants.connect('manual-changed', this._onManualChanged.bind(this));
this._systemShellThemeChangedConnect = e.settings.system.connect('shell-theme-changed', this._onSystemShellThemeChanged.bind(this));
}
_disconnectSettings() {
if (this._shellVariantChangedConnect) {
e.settingsManager.disconnect(this._shellVariantChangedConnect);
this._shellVariantChangedConnect = null;
if (this._variantChangedConnect) {
e.settings.shellVariants.disconnect(this._variantChangedConnect);
this._variantChangedConnect = null;
}
if (this._shellThemeChangedConnect) {
e.settingsManager.disconnect(this._shellThemeChangedConnect);
this._shellThemeChangedConnect = 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.');
}
@@ -120,48 +124,48 @@ var ShellThemer = class {
}
_onShellVariantsStatusChanged(_settings, _enabled) {
_onStatusChanged(_settings, _enabled) {
this.disable();
this.enable();
}
_onShellVariantChanged(_settings, changedVariantTime) {
_onVariantChanged(_settings, changedVariantTime) {
if (changedVariantTime === e.timer.time)
this._setVariant(e.timer.time);
this._setSystemVariant(e.timer.time);
}
_onShellThemeChanged(_settings, _newTheme) {
_onSystemShellThemeChanged(_settings, _newTheme) {
try {
this._updateVariants();
this._setVariant(e.timer.time);
this._setSystemVariant(e.timer.time);
} catch (error) {
notifyError(error);
}
}
_onManualShellVariantsChanged(_settings, enabled) {
_onManualChanged(_settings, enabled) {
this.disable();
this.enable();
if (enabled)
this._setVariant(e.timer.time);
this._setSystemVariant(e.timer.time);
}
_onTimeChanged(_timer, newTime) {
this._setVariant(newTime);
this._setSystemVariant(newTime);
}
_areVariantsUpToDate() {
return e.settingsManager.shellTheme === e.settingsManager.shellVariantDay || e.settingsManager.shellTheme === e.settingsManager.shellVariantNight;
return e.settings.system.shellTheme === e.settings.shellVariants.day || e.settings.system.shellTheme === e.settings.shellVariants.night;
}
_setVariant(time) {
_setSystemVariant(time) {
if (!time)
return;
logDebug(`Setting the shell ${time} variant...`);
const shellTheme = time === 'day' ? e.settingsManager.shellVariantDay : e.settingsManager.shellVariantNight;
if (e.settingsManager.useUserthemes) {
e.settingsManager.shellTheme = shellTheme;
const shellTheme = time === 'day' ? e.settings.shellVariants.day : e.settings.shellVariants.night;
if (e.settings.system.useUserthemes) {
e.settings.system.shellTheme = shellTheme;
} else {
const stylesheet = getShellThemeStylesheet(shellTheme);
applyShellStylesheet(stylesheet);
@@ -169,11 +173,11 @@ var ShellThemer = class {
}
_updateVariants() {
if (!e.settingsManager.useUserthemes || e.settingsManager.manualShellVariants || this._areVariantsUpToDate())
if (!e.settings.system.useUserthemes || e.settings.shellVariants.manual || this._areVariantsUpToDate())
return;
logDebug('Updating Shell variants...');
const originalTheme = e.settingsManager.shellTheme;
const originalTheme = e.settings.system.shellTheme;
const variants = ShellVariants.guessFrom(originalTheme);
const installedThemes = getInstalledShellThemes();
@@ -182,8 +186,8 @@ var ShellThemer = class {
throw new Error(message);
}
e.settingsManager.shellVariantDay = variants.get('day');
e.settingsManager.shellVariantNight = variants.get('night');
e.settings.shellVariants.day = variants.get('day');
e.settings.shellVariants.night = variants.get('night');
logDebug(`New Shell variants. { day: '${variants.get('day')}'; night: '${variants.get('night')}' }`);
}
+17 -17
View File
@@ -81,27 +81,27 @@ var Timer = class {
_connectSettings() {
logDebug('Connecting Timer to settings...');
this._nightlightStatusChangedConnect = e.settingsManager.connect('nightlight-status-changed', this._onSourceChanged.bind(this));
this._locationStatusChangedConnect = e.settingsManager.connect('location-status-changed', this._onSourceChanged.bind(this));
this._manualTimeSourceChangedConnect = e.settingsManager.connect('manual-time-source-changed', this._onSourceChanged.bind(this));
this._timeSourceChangedConnect = e.settingsManager.connect('time-source-changed', this._onTimeSourceChanged.bind(this));
this._nightlightStatusChangedConnect = e.settings.system.connect('nightlight-status-changed', this._onSourceChanged.bind(this));
this._locationStatusChangedConnect = e.settings.system.connect('location-status-changed', this._onSourceChanged.bind(this));
this._manualTimeSourceChangedConnect = e.settings.time.connect('manual-time-source-changed', this._onSourceChanged.bind(this));
this._timeSourceChangedConnect = e.settings.time.connect('time-source-changed', this._onTimeSourceChanged.bind(this));
}
_disconnectSettings() {
if (this._nightlightStatusChangedConnect) {
e.settingsManager.disconnect(this._nightlightStatusChangedConnect);
e.settings.system.disconnect(this._nightlightStatusChangedConnect);
this._nightlightStatusChangedConnect = null;
}
if (this._locationStatusChangedConnect) {
e.settingsManager.disconnect(this._locationStatusChangedConnect);
e.settings.system.disconnect(this._locationStatusChangedConnect);
this._locationStatusChangedConnect = null;
}
if (this._manualTimeSourceChangedConnect) {
e.settingsManager.disconnect(this._manualTimeSourceChangedConnect);
e.settings.time.disconnect(this._manualTimeSourceChangedConnect);
this._manualTimeSourceChangedConnect = null;
}
if (this._timeSourceChangedConnect) {
e.settingsManager.disconnect(this._timeSourceChangedConnect);
e.settings.time.disconnect(this._timeSourceChangedConnect);
this._timeSourceChangedConnect = null;
}
logDebug('Disconnected Timer from settings.');
@@ -155,7 +155,7 @@ var Timer = class {
}
_onTimeSourceChanged(_settings, _newSource) {
if (e.settingsManager.manualTimeSource)
if (e.settings.time.manualTimeSource)
this._onSourceChanged();
}
@@ -171,30 +171,30 @@ var Timer = class {
_getSource() {
logDebug('Getting time source...');
if (e.settingsManager.manualTimeSource) {
let source = e.settingsManager.timeSource;
if (e.settings.time.manualTimeSource) {
let source = e.settings.time.timeSource;
logDebug(`Time source is forced to ${source}.`);
if (
(source === 'nightlight' && !e.settingsManager.nightlightEnabled) ||
(source === 'location' && !e.settingsManager.locationEnabled)
(source === 'nightlight' && !e.settings.system.nightlightEnabled) ||
(source === 'location' && !e.settings.system.locationEnabled)
) {
logDebug(`Unable to choose ${source} time source, falling back to manual schedule.`);
source = 'schedule';
e.settingsManager.timeSource = source;
e.settings.time.timeSource = source;
}
return source;
}
let source;
if (e.settingsManager.nightlightEnabled)
if (e.settings.system.nightlightEnabled)
source = 'nightlight';
else if (e.settingsManager.locationEnabled)
else if (e.settings.system.locationEnabled)
source = 'location';
else
source = 'schedule';
logDebug(`Time source is ${source}.`);
e.settingsManager.timeSource = source;
e.settings.time.timeSource = source;
return source;
}
+2 -2
View File
@@ -46,8 +46,8 @@ var TimerLocation = class {
// Before we have the location suntimes, we'll use the manual schedule
// times
this._suntimes = new Map([
['sunrise', e.settingsManager.scheduleSunrise],
['sunset', e.settingsManager.scheduleSunrise],
['sunrise', e.settings.time.scheduleSunrise],
['sunset', e.settings.time.scheduleSunrise],
]);
this._geoclue = null;
this._geoclueConnect = null;
+10 -10
View File
@@ -65,24 +65,24 @@ var TimerOndemand = class {
get time() {
return e.settingsManager.ondemandTime;
return e.settings.time.ondemandTime;
}
_connectSettings() {
logDebug('Connecting On-demand Timer to settings...');
this._ondemandKeybindingConnect = e.settingsManager.connect('ondemand-keybinding-changed', this._onOndemandKeybindingChanged.bind(this));
this._ondemandButtonPlacementConnect = e.settingsManager.connect('ondemand-button-placement-changed', this._onOndemandButtonPlacementChanged.bind(this));
this._ondemandKeybindingConnect = e.settings.time.connect('ondemand-keybinding-changed', this._onOndemandKeybindingChanged.bind(this));
this._ondemandButtonPlacementConnect = e.settings.time.connect('ondemand-button-placement-changed', this._onOndemandButtonPlacementChanged.bind(this));
}
_disconnectSettings() {
logDebug('Disconnecting On-demand Timer from settings...');
if (this._ondemandKeybindingConnect) {
e.settingsManager.disconnect(this._ondemandKeybindingConnect);
e.settings.time.disconnect(this._ondemandKeybindingConnect);
this._ondemandKeybindingConnect = null;
}
if (this._ondemandButtonPlacementConnect) {
e.settingsManager.disconnect(this._ondemandButtonPlacementConnect);
e.settings.time.disconnect(this._ondemandButtonPlacementConnect);
this._ondemandButtonPlacementConnect = null;
}
}
@@ -100,13 +100,13 @@ var TimerOndemand = class {
_addKeybinding() {
this._previousKeybinding = e.settingsManager.ondemandKeybinding;
if (!e.settingsManager.ondemandKeybinding)
this._previousKeybinding = e.settings.time.ondemandKeybinding;
if (!e.settings.time.ondemandKeybinding)
return;
logDebug('Adding On-demand Timer keybinding...');
main.wm.addKeybinding(
'nightthemeswitcher-ondemand-keybinding',
e.settingsManager._extensionsSettings,
e.settings.time.settings,
keyBindingAutoRepeat(),
Shell.ActionMode.NORMAL | Shell.ActionMode.OVERVIEW,
this._toggleTime.bind(this)
@@ -123,7 +123,7 @@ var TimerOndemand = class {
}
_addButton() {
switch (e.settingsManager.ondemandButtonPlacement) {
switch (e.settings.time.ondemandButtonPlacement) {
case 'panel':
this._addButtonToPanel();
break;
@@ -177,7 +177,7 @@ var TimerOndemand = class {
}
_toggleTime() {
e.settingsManager.ondemandTime = e.timer.time === 'day' ? 'night' : 'day';
e.settings.time.ondemandTime = e.timer.time === 'day' ? 'night' : 'day';
this.emit('time-changed', this.time);
}
+1 -1
View File
@@ -62,7 +62,7 @@ var TimerSchedule = class {
_isDaytime() {
const time = GLib.DateTime.new_now_local();
const hour = time.get_hour() + time.get_minute() / 60 + time.get_second() / 3600;
return hour >= e.settingsManager.scheduleSunrise && hour <= e.settingsManager.scheduleSunset;
return hour >= e.settings.time.scheduleSunrise && hour <= e.settings.time.scheduleSunset;
}
_watchForTimeChange() {
+221 -166
View File
@@ -7,8 +7,8 @@ msgid ""
msgstr ""
"Project-Id-Version: Night Theme Switcher 7\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-08-05 08:43+0200\n"
"PO-Revision-Date: 2020-08-06 12:53+0200\n"
"POT-Creation-Date: 2020-09-23 11:56+0200\n"
"PO-Revision-Date: 2020-09-23 11:57+0200\n"
"Last-Translator: Romain Vigier <romain@romainvigier.fr>\n"
"Language-Team: French - France <romain@romainvigier.fr>\n"
"Language: fr_FR\n"
@@ -18,15 +18,15 @@ msgstr ""
"Plural-Forms: nplurals=2; plural=(n > 1)\n"
"X-Generator: Gtranslator 3.36.0\n"
#: src/prefs.js:227 src/prefs.ui:644
#: src/prefs.js:230 src/prefs.ui:643
msgid "Choose"
msgstr "Choisir"
#: src/prefs.js:347
#: src/prefs.js:350
msgid "Default"
msgstr "Par défaut"
#: src/modules/GtkThemer.js:176
#: src/modules/GtkThemer.js:179
#, javascript-format
msgid ""
"Unable to automatically detect the day and night variants for the \"%s\" GTK "
@@ -36,7 +36,7 @@ msgstr ""
"pour le thème GTK \"%s\". Veuillez les sélectionner manuellement dans les "
"préférences de lextension."
#: src/modules/ShellThemer.js:183
#: src/modules/ShellThemer.js:185
#, javascript-format
msgid ""
"Unable to automatically detect the day and night variants for the \"%s\" "
@@ -47,269 +47,299 @@ msgstr ""
"pour le thème GNOME Shell \"%s\". Veuillez les sélectionner manuellement "
"dans les préférences de lextension."
#: src/modules/TimerOndemand.js:162
#: src/modules/TimerOndemand.js:167
msgid "Switch to night theme"
msgstr "Passer au thème nocturne"
#: src/modules/TimerOndemand.js:162
#: src/modules/TimerOndemand.js:167
msgid "Switch to day theme"
msgstr "Passer au thème diurne"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:6
#: src/prefs.ui:816
msgid "Settings version"
msgstr "Version des paramètres"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:7
msgid "The current extension settings version"
msgstr "La version actuelle des paramètres de lextension"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:13
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:6
#: src/prefs.ui:821
msgid "Switch GTK variants"
msgstr "Permuter les variantes GTK"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:7
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:14
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:7
msgid "Enable GTK variants switching"
msgstr "Activer le changement de variantes GTK"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:11
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:18
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:11
msgid "Day GTK theme"
msgstr "Thème GTK diurne"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:12
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:19
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:12
msgid "The GTK theme to use during daytime"
msgstr "Le thème GTK à utiliser le jour"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:16
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:23
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:16
msgid "Night GTK theme"
msgstr "Thème GTK nocturne"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:17
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:24
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:17
msgid "The GTK theme to use during nighttime"
msgstr "Le thème GTK à utiliser la nuit"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:21
msgid "Original GTK theme"
msgstr "Thème GTK original"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:22
msgid "The GTK theme to restore when the extension is disabled"
msgstr "Le thème GTK à restaurer quand lextension est désactivée"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:26
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:28
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:21
msgid "Use manual GTK variants"
msgstr "Utiliser des variantes GTK manuelles"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:27
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:29
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:22
msgid "Disable automatic GTK theme variants detection"
msgstr "Désactiver la détection automatique des variantes du thème GTK"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:31
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:35
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:26
msgid "Switch shell variants"
msgstr "Permuter les variantes du shell"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:32
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:36
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:27
msgid "Enable shell variants switching"
msgstr "Activer le changement des variantes du shell"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:36
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:40
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:31
msgid "Day shell theme"
msgstr "Thème shell diurne"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:37
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:41
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:32
msgid "The shell theme to use during daytime"
msgstr "Le thème shell à utiliser le jour"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:41
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:45
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:36
msgid "Night shell theme"
msgstr "Thème shell nocturne"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:42
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:46
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:37
msgid "The shell theme to use during nighttime"
msgstr "Le thème shell à utiliser la nuit"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:46
msgid "Original shell theme"
msgstr "Thème shell original"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:47
msgid "The shell theme to restore when the extension is disabled"
msgstr "Le thème shell à restaurer quand lextension est désactivée"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:51
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:50
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:41
msgid "Use manual shell variants"
msgstr "Utiliser des variantes shell manuelles"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:52
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:51
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:42
msgid "Disable automatic shell theme variants detection"
msgstr "Désactiver la détection automatique des variantes du thème shell"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:56
#: src/prefs.ui:1504
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:57
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:46
#: src/prefs.ui:1509
msgid "Switch icon variants"
msgstr "Permuter les variantes dicônes"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:57
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:58
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:47
msgid "Enable icon variants switching"
msgstr "Activer le changement de variantes dicônes"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:61
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:62
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:51
msgid "Day icon theme"
msgstr "Thème dicônes diurne"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:62
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:63
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:52
msgid "The icon theme to use during daytime"
msgstr "Le thème dicônes à utiliser le jour"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:66
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:67
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:56
msgid "Night icon theme"
msgstr "Thème dicônes nocturne"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:67
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:68
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:57
msgid "The icon theme to use during nighttime"
msgstr "Le thème dicônes à utiliser la nuit"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:71
msgid "Original icon theme"
msgstr "Thème dicônes original"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:72
msgid "The icon theme to restore when the extension is disabled"
msgstr "Le thème dicônes à restaurer quand lextension est désactivée"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:76
#: src/prefs.ui:1750
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:74
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:61
#: src/prefs.ui:1755
msgid "Switch cursor variants"
msgstr "Permuter les variantes de curseur"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:77
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:75
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:62
msgid "Enable cursor variants switching"
msgstr "Activer le changement de variantes de curseur"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:81
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:79
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:66
msgid "Day cursor theme"
msgstr "Thème de curseurs diurne"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:82
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:80
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:67
msgid "The cursor theme to use during daytime"
msgstr "Le thème de curseurs à utiliser le jour"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:86
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:84
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:71
msgid "Night cursor theme"
msgstr "Thème de curseurs nocturne"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:87
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:85
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:72
msgid "The cursor theme to use during nighttime"
msgstr "Le thème de curseurs à utiliser la nuit"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:91
msgid "Original cursor theme"
msgstr "Thème de curseurs original"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:92
msgid "The cursor theme to restore when the extension is disabled"
msgstr "Le thème de curseurs à restaurer quand lextension est désactivée"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:102
msgid "Time source"
msgstr "Source dhoraires"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:103
msgid "The source used to check current time"
msgstr "Source utilisée pour vérifier les horaires"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:111
msgid "On-demand time"
msgstr "Temps à la demande"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:112
msgid "The current time used in on-demand mode"
msgstr "Le temps actuel utilisé dans le mode à la demande"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:116
msgid "Key combination to toggle time"
msgstr "Combinaison de touches pour permuter le temps"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:117
msgid "The key combination that will toggle time in on-demand mode"
msgstr "La combinaison de touches qui permutera le temps en mode à la demande"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:126
msgid "On-demand button placement"
msgstr "Emplacement du bouton à la demande"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:127
msgid "Where the on-demand button will be placed"
msgstr "Où le bouton du changement à la demande sera placé"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:131
msgid "Use manual time source"
msgstr "Utiliser une source dhoraires manuelle"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:132
msgid "Disable automatic time source detection"
msgstr "Désactive la détection automatique de la source dhoraires"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:136
msgid "Sunrise time"
msgstr "Heure du lever"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:137
msgid "When the day starts"
msgstr "Quand le jour se lève"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:141
msgid "Sunset time"
msgstr "Heure du coucher"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:142
msgid "When the day ends"
msgstr "Quand le jour se couche"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:146
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:126
msgid "Enable commands"
msgstr "Activer les commandes"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:147
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:92
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:127
msgid "Commands will be spawned on time change"
msgstr "Les commandes seront lancées au changement dhoraire"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:151
#: src/prefs.ui:2369
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:96
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:131
#: src/prefs.ui:2432
msgid "Sunrise command"
msgstr "Commande du lever de soleil"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:152
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:97
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:132
msgid "The command to spawn at sunrise"
msgstr "La commande à lancer quand le soleil se lève"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:156
#: src/prefs.ui:2428
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:101
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:136
#: src/prefs.ui:2523
msgid "Sunset command"
msgstr "Commande du coucher de soleil"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:157
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:102
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:137
msgid "The command to spawn at sunset"
msgstr "La commande à lancer quand le soleil se couche"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:161
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:108
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:141
msgid "Enable backgrounds"
msgstr "Activer les arrière-plans"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:162
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:109
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:142
msgid "Background will be changed on time change"
msgstr "Larrière-plan changera au changement dhoraire"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:166
#: src/prefs.ui:2083
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:113
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:146
#: src/prefs.ui:2088
msgid "Day background"
msgstr "Arrière-plan diurne"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:167
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:114
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:147
msgid "Path to the day background"
msgstr "Chemin vers larrière-plan diurne"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:171
#: src/prefs.ui:2143
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:118
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:151
#: src/prefs.ui:2177
msgid "Night background"
msgstr "Arrière-plan nocturne"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:172
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:119
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:152
msgid "Path to the night background"
msgstr "Chemin vers larrière-plan nocturne"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:131
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:82
msgid "Time source"
msgstr "Source dhoraires"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:132
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:83
msgid "The source used to check current time"
msgstr "Source utilisée pour vérifier les horaires"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:140
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:91
msgid "On-demand time"
msgstr "Temps à la demande"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:141
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:92
msgid "The current time used in on-demand mode"
msgstr "Le temps actuel utilisé dans le mode à la demande"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:145
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:96
msgid "Key combination to toggle time"
msgstr "Combinaison de touches pour permuter le temps"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:146
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:97
msgid "The key combination that will toggle time in on-demand mode"
msgstr "La combinaison de touches qui permutera le temps en mode à la demande"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:155
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:106
msgid "On-demand button placement"
msgstr "Emplacement du bouton à la demande"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:156
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:107
msgid "Where the on-demand button will be placed"
msgstr "Où le bouton du changement à la demande sera placé"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:160
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:111
msgid "Use manual time source"
msgstr "Utiliser une source dhoraires manuelle"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:161
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:112
msgid "Disable automatic time source detection"
msgstr "Désactive la détection automatique de la source dhoraires"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:165
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:116
msgid "Sunrise time"
msgstr "Heure du lever"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:166
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:117
msgid "When the day starts"
msgstr "Quand le jour se lève"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:170
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:121
msgid "Sunset time"
msgstr "Heure du coucher"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:171
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:122
msgid "When the day ends"
msgstr "Quand le jour se couche"
#: src/prefs.ui:58
msgid "Press your keyboard shortcut..."
msgstr "Pressez votre raccourci clavier…"
@@ -373,35 +403,36 @@ msgstr ":"
msgid "Sunset"
msgstr "Coucher du soleil"
#: src/prefs.ui:659
#: src/prefs.ui:658 src/prefs.ui:2121 src/prefs.ui:2210 src/prefs.ui:2464
#: src/prefs.ui:2555
msgid "Clear"
msgstr "Effacer"
#: src/prefs.ui:713
#: src/prefs.ui:718
msgid "Button location"
msgstr "Emplacement du bouton"
#: src/prefs.ui:728
#: src/prefs.ui:733
msgid "None"
msgstr "Aucun"
#: src/prefs.ui:729
#: src/prefs.ui:734
msgid "Top bar"
msgstr "Barre supérieure"
#: src/prefs.ui:730
#: src/prefs.ui:735
msgid "System menu"
msgstr "Menu système"
#: src/prefs.ui:768
#: src/prefs.ui:773
msgid "Schedule"
msgstr "Horaires"
#: src/prefs.ui:888 src/prefs.ui:963 src/prefs.ui:1232 src/prefs.ui:1307
#: src/prefs.ui:893 src/prefs.ui:968 src/prefs.ui:1237 src/prefs.ui:1312
msgid "Manual variants"
msgstr "Variantes manuelles"
#: src/prefs.ui:901
#: src/prefs.ui:906
msgid ""
"<small>You can manually set variants if the extension cannot automatically "
"detect the day and night variants of your GTK theme. Please <a href="
@@ -414,23 +445,23 @@ msgstr ""
"shell-extension/-/issues\">soumettre une requête</a> pour obtenir le support "
"de votre thème.</small>"
#: src/prefs.ui:1002 src/prefs.ui:1346 src/prefs.ui:1592 src/prefs.ui:1838
#: src/prefs.ui:1007 src/prefs.ui:1351 src/prefs.ui:1597 src/prefs.ui:1843
msgid "Day variant"
msgstr "Variante diurne"
#: src/prefs.ui:1058 src/prefs.ui:1402 src/prefs.ui:1648 src/prefs.ui:1894
#: src/prefs.ui:1063 src/prefs.ui:1407 src/prefs.ui:1653 src/prefs.ui:1899
msgid "Night variant"
msgstr "Variante nocturne"
#: src/prefs.ui:1111
#: src/prefs.ui:1116
msgid "GTK theme"
msgstr "Thème GTK"
#: src/prefs.ui:1160
#: src/prefs.ui:1165
msgid "Switch Shell variants"
msgstr "Permuter les variantes Shell"
#: src/prefs.ui:1245
#: src/prefs.ui:1250
msgid ""
"<small>You can manually set variants if the extension cannot automatically "
"detect the day and night variants of your GNOME Shell theme. Please <a href="
@@ -443,39 +474,39 @@ msgstr ""
"gnome-shell-extension/-/issues\">soumettre une requête</a> pour obtenir le "
"support de votre thème.</small>"
#: src/prefs.ui:1455
#: src/prefs.ui:1460
msgid "Shell theme"
msgstr "Thème du shell"
#: src/prefs.ui:1553 src/prefs.ui:1799
#: src/prefs.ui:1558 src/prefs.ui:1804
msgid "Variants"
msgstr "Variantes"
#: src/prefs.ui:1701
#: src/prefs.ui:1706
msgid "Icon theme"
msgstr "Thème dicônes"
#: src/prefs.ui:1947
#: src/prefs.ui:1952
msgid "Cursor theme"
msgstr "Thème de curseur"
#: src/prefs.ui:1996
#: src/prefs.ui:2001
msgid "Switch backgrounds"
msgstr "Permuter les arrière-plans"
#: src/prefs.ui:2044 src/prefs.ui:2200
#: src/prefs.ui:2049 src/prefs.ui:2263
msgid "Backgrounds"
msgstr "Arrière-plans"
#: src/prefs.ui:2100 src/prefs.ui:2160
#: src/prefs.ui:2111 src/prefs.ui:2200
msgid "Select your background image"
msgstr "Sélectionnez votre image darrière-plan"
#: src/prefs.ui:2255
#: src/prefs.ui:2318
msgid "Run commands"
msgstr "Lancer des commandes"
#: src/prefs.ui:2268
#: src/prefs.ui:2331
msgid ""
"<small>You can set custom commands that will be run when the time of the day "
"changes.</small>"
@@ -483,18 +514,42 @@ msgstr ""
"<small>Vous pouvez définir des commandes personnalisées qui seront lancées "
"quand le moment du jour change.</small>"
#: src/prefs.ui:2330 src/prefs.ui:2484
#: src/prefs.ui:2393 src/prefs.ui:2611
msgid "Commands"
msgstr "Commandes"
#: src/prefs.ui:2385
#: src/prefs.ui:2453
msgid "notify-send \"Hello sunshine!\""
msgstr "notify-send \"Bonjour!\""
#: src/prefs.ui:2444
#: src/prefs.ui:2544
msgid "notify-send \"Hello moonshine!\""
msgstr "notify-send \"Bonsoir!\""
#~ msgid "Original GTK theme"
#~ msgstr "Thème GTK original"
#~ msgid "The GTK theme to restore when the extension is disabled"
#~ msgstr "Le thème GTK à restaurer quand lextension est désactivée"
#~ msgid "Original shell theme"
#~ msgstr "Thème shell original"
#~ msgid "The shell theme to restore when the extension is disabled"
#~ msgstr "Le thème shell à restaurer quand lextension est désactivée"
#~ msgid "Original icon theme"
#~ msgstr "Thème dicônes original"
#~ msgid "The icon theme to restore when the extension is disabled"
#~ msgstr "Le thème dicônes à restaurer quand lextension est désactivée"
#~ msgid "Original cursor theme"
#~ msgstr "Thème de curseurs original"
#~ msgid "The cursor theme to restore when the extension is disabled"
#~ msgstr "Le thème de curseurs à restaurer quand lextension est désactivée"
#~ msgid "You can set different backgrounds for day and night."
#~ msgstr ""
#~ "Vous pouvez définir des arrière-plans diurnes et nocturnes différents."
+197 -166
View File
@@ -6,9 +6,9 @@
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: Night Theme Switcher 34\n"
"Project-Id-Version: Night Theme Switcher 37\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-08-05 08:43+0200\n"
"POT-Creation-Date: 2020-09-23 11:56+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -17,22 +17,22 @@ msgstr ""
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
#: src/prefs.js:227 src/prefs.ui:644
#: src/prefs.js:230 src/prefs.ui:643
msgid "Choose"
msgstr ""
#: src/prefs.js:347
#: src/prefs.js:350
msgid "Default"
msgstr ""
#: src/modules/GtkThemer.js:176
#: src/modules/GtkThemer.js:179
#, javascript-format
msgid ""
"Unable to automatically detect the day and night variants for the \"%s\" GTK "
"theme. Please manually choose them in the extension's preferences."
msgstr ""
#: src/modules/ShellThemer.js:183
#: src/modules/ShellThemer.js:185
#, javascript-format
msgid ""
"Unable to automatically detect the day and night variants for the \"%s\" "
@@ -40,269 +40,299 @@ msgid ""
"preferences."
msgstr ""
#: src/modules/TimerOndemand.js:162
#: src/modules/TimerOndemand.js:167
msgid "Switch to night theme"
msgstr ""
#: src/modules/TimerOndemand.js:162
#: src/modules/TimerOndemand.js:167
msgid "Switch to day theme"
msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:6
#: src/prefs.ui:816
msgid "Switch GTK variants"
msgid "Settings version"
msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:7
msgid "The current extension settings version"
msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:13
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:6
#: src/prefs.ui:821
msgid "Switch GTK variants"
msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:14
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:7
msgid "Enable GTK variants switching"
msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:11
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:18
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:11
msgid "Day GTK theme"
msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:12
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:19
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:12
msgid "The GTK theme to use during daytime"
msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:16
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:23
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:16
msgid "Night GTK theme"
msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:17
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:24
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:17
msgid "The GTK theme to use during nighttime"
msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:21
msgid "Original GTK theme"
msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:22
msgid "The GTK theme to restore when the extension is disabled"
msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:26
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:28
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:21
msgid "Use manual GTK variants"
msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:27
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:29
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:22
msgid "Disable automatic GTK theme variants detection"
msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:31
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:35
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:26
msgid "Switch shell variants"
msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:32
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:36
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:27
msgid "Enable shell variants switching"
msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:36
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:40
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:31
msgid "Day shell theme"
msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:37
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:41
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:32
msgid "The shell theme to use during daytime"
msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:41
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:45
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:36
msgid "Night shell theme"
msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:42
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:46
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:37
msgid "The shell theme to use during nighttime"
msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:46
msgid "Original shell theme"
msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:47
msgid "The shell theme to restore when the extension is disabled"
msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:51
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:50
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:41
msgid "Use manual shell variants"
msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:52
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:51
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:42
msgid "Disable automatic shell theme variants detection"
msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:56
#: src/prefs.ui:1504
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:57
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:46
#: src/prefs.ui:1509
msgid "Switch icon variants"
msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:57
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:58
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:47
msgid "Enable icon variants switching"
msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:61
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:62
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:51
msgid "Day icon theme"
msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:62
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:63
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:52
msgid "The icon theme to use during daytime"
msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:66
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:67
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:56
msgid "Night icon theme"
msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:67
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:68
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:57
msgid "The icon theme to use during nighttime"
msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:71
msgid "Original icon theme"
msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:72
msgid "The icon theme to restore when the extension is disabled"
msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:76
#: src/prefs.ui:1750
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:74
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:61
#: src/prefs.ui:1755
msgid "Switch cursor variants"
msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:77
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:75
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:62
msgid "Enable cursor variants switching"
msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:81
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:79
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:66
msgid "Day cursor theme"
msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:82
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:80
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:67
msgid "The cursor theme to use during daytime"
msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:86
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:84
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:71
msgid "Night cursor theme"
msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:87
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:85
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:72
msgid "The cursor theme to use during nighttime"
msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:91
msgid "Original cursor theme"
msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:92
msgid "The cursor theme to restore when the extension is disabled"
msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:102
msgid "Time source"
msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:103
msgid "The source used to check current time"
msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:111
msgid "On-demand time"
msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:112
msgid "The current time used in on-demand mode"
msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:116
msgid "Key combination to toggle time"
msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:117
msgid "The key combination that will toggle time in on-demand mode"
msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:126
msgid "On-demand button placement"
msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:127
msgid "Where the on-demand button will be placed"
msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:131
msgid "Use manual time source"
msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:132
msgid "Disable automatic time source detection"
msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:136
msgid "Sunrise time"
msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:137
msgid "When the day starts"
msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:141
msgid "Sunset time"
msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:142
msgid "When the day ends"
msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:146
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:126
msgid "Enable commands"
msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:147
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:92
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:127
msgid "Commands will be spawned on time change"
msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:151
#: src/prefs.ui:2369
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:96
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:131
#: src/prefs.ui:2432
msgid "Sunrise command"
msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:152
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:97
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:132
msgid "The command to spawn at sunrise"
msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:156
#: src/prefs.ui:2428
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:101
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:136
#: src/prefs.ui:2523
msgid "Sunset command"
msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:157
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:102
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:137
msgid "The command to spawn at sunset"
msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:161
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:108
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:141
msgid "Enable backgrounds"
msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:162
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:109
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:142
msgid "Background will be changed on time change"
msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:166
#: src/prefs.ui:2083
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:113
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:146
#: src/prefs.ui:2088
msgid "Day background"
msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:167
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:114
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:147
msgid "Path to the day background"
msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:171
#: src/prefs.ui:2143
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:118
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:151
#: src/prefs.ui:2177
msgid "Night background"
msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:172
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:119
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:152
msgid "Path to the night background"
msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:131
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:82
msgid "Time source"
msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:132
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:83
msgid "The source used to check current time"
msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:140
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:91
msgid "On-demand time"
msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:141
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:92
msgid "The current time used in on-demand mode"
msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:145
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:96
msgid "Key combination to toggle time"
msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:146
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:97
msgid "The key combination that will toggle time in on-demand mode"
msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:155
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:106
msgid "On-demand button placement"
msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:156
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:107
msgid "Where the on-demand button will be placed"
msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:160
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:111
msgid "Use manual time source"
msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:161
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:112
msgid "Disable automatic time source detection"
msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:165
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:116
msgid "Sunrise time"
msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:166
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:117
msgid "When the day starts"
msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:170
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:121
msgid "Sunset time"
msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:171
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:122
msgid "When the day ends"
msgstr ""
#: src/prefs.ui:58
msgid "Press your keyboard shortcut..."
msgstr ""
@@ -362,35 +392,36 @@ msgstr ""
msgid "Sunset"
msgstr ""
#: src/prefs.ui:659
#: src/prefs.ui:658 src/prefs.ui:2121 src/prefs.ui:2210 src/prefs.ui:2464
#: src/prefs.ui:2555
msgid "Clear"
msgstr ""
#: src/prefs.ui:713
#: src/prefs.ui:718
msgid "Button location"
msgstr ""
#: src/prefs.ui:728
#: src/prefs.ui:733
msgid "None"
msgstr ""
#: src/prefs.ui:729
#: src/prefs.ui:734
msgid "Top bar"
msgstr ""
#: src/prefs.ui:730
#: src/prefs.ui:735
msgid "System menu"
msgstr ""
#: src/prefs.ui:768
#: src/prefs.ui:773
msgid "Schedule"
msgstr ""
#: src/prefs.ui:888 src/prefs.ui:963 src/prefs.ui:1232 src/prefs.ui:1307
#: src/prefs.ui:893 src/prefs.ui:968 src/prefs.ui:1237 src/prefs.ui:1312
msgid "Manual variants"
msgstr ""
#: src/prefs.ui:901
#: src/prefs.ui:906
msgid ""
"<small>You can manually set variants if the extension cannot automatically "
"detect the day and night variants of your GTK theme. Please <a href="
@@ -398,23 +429,23 @@ msgid ""
"\">submit a request</a> to get your theme supported.</small>"
msgstr ""
#: src/prefs.ui:1002 src/prefs.ui:1346 src/prefs.ui:1592 src/prefs.ui:1838
#: src/prefs.ui:1007 src/prefs.ui:1351 src/prefs.ui:1597 src/prefs.ui:1843
msgid "Day variant"
msgstr ""
#: src/prefs.ui:1058 src/prefs.ui:1402 src/prefs.ui:1648 src/prefs.ui:1894
#: src/prefs.ui:1063 src/prefs.ui:1407 src/prefs.ui:1653 src/prefs.ui:1899
msgid "Night variant"
msgstr ""
#: src/prefs.ui:1111
#: src/prefs.ui:1116
msgid "GTK theme"
msgstr ""
#: src/prefs.ui:1160
#: src/prefs.ui:1165
msgid "Switch Shell variants"
msgstr ""
#: src/prefs.ui:1245
#: src/prefs.ui:1250
msgid ""
"<small>You can manually set variants if the extension cannot automatically "
"detect the day and night variants of your GNOME Shell theme. Please <a href="
@@ -422,52 +453,52 @@ msgid ""
"\">submit a request</a> to get your theme supported.</small>"
msgstr ""
#: src/prefs.ui:1455
#: src/prefs.ui:1460
msgid "Shell theme"
msgstr ""
#: src/prefs.ui:1553 src/prefs.ui:1799
#: src/prefs.ui:1558 src/prefs.ui:1804
msgid "Variants"
msgstr ""
#: src/prefs.ui:1701
#: src/prefs.ui:1706
msgid "Icon theme"
msgstr ""
#: src/prefs.ui:1947
#: src/prefs.ui:1952
msgid "Cursor theme"
msgstr ""
#: src/prefs.ui:1996
#: src/prefs.ui:2001
msgid "Switch backgrounds"
msgstr ""
#: src/prefs.ui:2044 src/prefs.ui:2200
#: src/prefs.ui:2049 src/prefs.ui:2263
msgid "Backgrounds"
msgstr ""
#: src/prefs.ui:2100 src/prefs.ui:2160
#: src/prefs.ui:2111 src/prefs.ui:2200
msgid "Select your background image"
msgstr ""
#: src/prefs.ui:2255
#: src/prefs.ui:2318
msgid "Run commands"
msgstr ""
#: src/prefs.ui:2268
#: src/prefs.ui:2331
msgid ""
"<small>You can set custom commands that will be run when the time of the day "
"changes.</small>"
msgstr ""
#: src/prefs.ui:2330 src/prefs.ui:2484
#: src/prefs.ui:2393 src/prefs.ui:2611
msgid "Commands"
msgstr ""
#: src/prefs.ui:2385
#: src/prefs.ui:2453
msgid "notify-send \"Hello sunshine!\""
msgstr ""
#: src/prefs.ui:2444
#: src/prefs.ui:2544
msgid "notify-send \"Hello moonshine!\""
msgstr ""
+119 -116
View File
@@ -24,6 +24,7 @@ const { extensionUtils } = imports.misc;
const Me = extensionUtils.getCurrentExtension();
const { compat, utils } = Me.imports;
const { Settings } = Me.imports.settings.Settings;
const Gettext = imports.gettext.domain(Me.metadata.uuid);
const _ = Gettext.gettext;
@@ -42,9 +43,11 @@ function buildPrefsWidget() {
const Preferences = class {
constructor() {
this.settings = compat.getExtensionSettings();
this.colorSettings = new Gio.Settings({ schema: 'org.gnome.settings-daemon.plugins.color' });
this.locationSettings = new Gio.Settings({ schema: 'org.gnome.system.location' });
// this.settings = compat.getExtensionSettings();
this.settings = new Settings();
this.settings.enable();
// this.colorSettings = new Gio.Settings({ schema: 'org.gnome.settings-daemon.plugins.color' });
// this.locationSettings = new Gio.Settings({ schema: 'org.gnome.system.location' });
this.builder = new Gtk.Builder();
this.builder.set_translation_domain(Me.metadata.uuid);
@@ -66,7 +69,7 @@ const Preferences = class {
_connectSchedulePreferences() {
const scheduleAutoSwitch = this.builder.get_object('prefs_schedule_auto_switch');
this.settings.bind(
this.settings.time.settings.bind(
'manual-time-source',
scheduleAutoSwitch,
'active',
@@ -74,7 +77,7 @@ const Preferences = class {
);
const scheduleManualTimeSource = this.builder.get_object('prefs_schedule_manual_time_source');
this.settings.bind(
this.settings.time.settings.bind(
'manual-time-source',
scheduleManualTimeSource,
'sensitive',
@@ -83,10 +86,10 @@ const Preferences = class {
const scheduleManualTimeSourceNightlightRadio = this.builder.get_object('prefs_schedule_manual_time_source_nightlight_radio');
const updateScheduleManualTimeSourceNightlightRadioActivity = () => {
scheduleManualTimeSourceNightlightRadio.active = this.settings.get_string('time-source') === 'nightlight';
scheduleManualTimeSourceNightlightRadio.active = this.settings.time.timeSource === 'nightlight';
};
this.settings.connect('changed::time-source', () => updateScheduleManualTimeSourceNightlightRadioActivity());
this.colorSettings.bind(
this.settings.time.connect('time-source-changed', () => updateScheduleManualTimeSourceNightlightRadioActivity());
this.settings.system.colorSettings.bind(
'night-light-enabled',
scheduleManualTimeSourceNightlightRadio,
'sensitive',
@@ -94,16 +97,16 @@ const Preferences = class {
);
scheduleManualTimeSourceNightlightRadio.connect('toggled', () => {
if (scheduleManualTimeSourceNightlightRadio.active)
this.settings.set_string('time-source', 'nightlight');
this.settings.time.timeSource = 'nightlight';
});
updateScheduleManualTimeSourceNightlightRadioActivity();
const scheduleManualTimeSourceLocationRadio = this.builder.get_object('prefs_schedule_manual_time_source_location_radio');
const updateScheduleManualTimeSourceLocationRadioActivity = () => {
scheduleManualTimeSourceLocationRadio.active = this.settings.get_string('time-source') === 'location';
scheduleManualTimeSourceLocationRadio.active = this.settings.time.timeSource === 'location';
};
this.settings.connect('changed::time-source', () => updateScheduleManualTimeSourceLocationRadioActivity());
this.locationSettings.bind(
this.settings.time.connect('time-source-changed', () => updateScheduleManualTimeSourceLocationRadioActivity());
this.settings.system.locationSettings.bind(
'enabled',
scheduleManualTimeSourceLocationRadio,
'sensitive',
@@ -111,122 +114,122 @@ const Preferences = class {
);
scheduleManualTimeSourceLocationRadio.connect('toggled', () => {
if (scheduleManualTimeSourceLocationRadio.active)
this.settings.set_string('time-source', 'location');
this.settings.time.timeSource = 'location';
});
updateScheduleManualTimeSourceLocationRadioActivity();
const scheduleManualTimeSourceManualRadio = this.builder.get_object('prefs_schedule_manual_time_source_manual_radio');
const updateScheduleManualTimeSourceManualRadioActivity = () => {
scheduleManualTimeSourceManualRadio.active = this.settings.get_string('time-source') === 'schedule';
scheduleManualTimeSourceManualRadio.active = this.settings.time.timeSource === 'schedule';
};
this.settings.connect('changed::time-source', () => updateScheduleManualTimeSourceManualRadioActivity());
this.settings.time.connect('time-source-changed', () => updateScheduleManualTimeSourceManualRadioActivity());
scheduleManualTimeSourceManualRadio.connect('toggled', () => {
if (scheduleManualTimeSourceManualRadio.active)
this.settings.set_string('time-source', 'schedule');
this.settings.time.timeSource = 'schedule';
});
updateScheduleManualTimeSourceManualRadioActivity();
const scheduleManualTimeSourceOndemandRadio = this.builder.get_object('prefs_schedule_manual_time_source_ondemand_radio');
const updateScheduleManualTimeSourceOndemandRadioActivity = () => {
scheduleManualTimeSourceOndemandRadio.active = this.settings.get_string('time-source') === 'ondemand';
scheduleManualTimeSourceOndemandRadio.active = this.settings.time.timeSource === 'ondemand';
};
this.settings.connect('changed::time-source', () => updateScheduleManualTimeSourceOndemandRadioActivity());
this.settings.time.connect('time-source-changed', () => updateScheduleManualTimeSourceOndemandRadioActivity());
scheduleManualTimeSourceOndemandRadio.connect('toggled', () => {
if (scheduleManualTimeSourceOndemandRadio.active)
this.settings.set_string('time-source', 'ondemand');
this.settings.time.timeSource = 'ondemand';
});
updateScheduleManualTimeSourceOndemandRadioActivity();
const scheduleManualScheduleTimes = this.builder.get_object('prefs_schedule_manual_schedule_times');
const updateScheduleManualScheduleTimesVisibility = () => {
scheduleManualScheduleTimes.visible = this.settings.get_string('time-source') === 'schedule';
scheduleManualScheduleTimes.visible = this.settings.time.timeSource === 'schedule';
};
this.settings.bind(
this.settings.time.settings.bind(
'manual-time-source',
scheduleManualScheduleTimes,
'sensitive',
Gio.SettingsBindFlags.DEFAULT
);
this.settings.connect('changed::time-source', () => updateScheduleManualScheduleTimesVisibility());
this.settings.time.connect('time-source-changed', () => updateScheduleManualScheduleTimesVisibility());
updateScheduleManualScheduleTimesVisibility();
const scheduleManualScheduleTimesSunriseHoursSpin = this.builder.get_object('prefs_schedule_manual_schedule_times_sunrise_hours_spin');
scheduleManualScheduleTimesSunriseHoursSpin.value = Math.trunc(this.settings.get_double('schedule-sunrise'));
scheduleManualScheduleTimesSunriseHoursSpin.value = Math.trunc(this.settings.time.scheduleSunrise);
scheduleManualScheduleTimesSunriseHoursSpin.connect('output', () => {
const text = scheduleManualScheduleTimesSunriseHoursSpin.adjustment.value.toString().padStart(2, '0');
scheduleManualScheduleTimesSunriseHoursSpin.set_text(text);
return true;
});
scheduleManualScheduleTimesSunriseHoursSpin.connect('value-changed', () => {
const oldTime = this.settings.get_double('schedule-sunrise');
const oldTime = this.settings.time.scheduleSunrise;
const oldHour = Math.trunc(oldTime);
const newMinutes = oldTime - oldHour;
const newTime = scheduleManualScheduleTimesSunriseHoursSpin.value + newMinutes;
this.settings.set_double('schedule-sunrise', newTime);
this.settings.time.scheduleSunrise = newTime;
});
const scheduleManualScheduleTimesSunriseMinutesSpin = this.builder.get_object('prefs_schedule_manual_schedule_times_sunrise_minutes_spin');
scheduleManualScheduleTimesSunriseMinutesSpin.value = Math.round((this.settings.get_double('schedule-sunrise') - Math.trunc(this.settings.get_double('schedule-sunrise'))) * 60);
scheduleManualScheduleTimesSunriseMinutesSpin.value = Math.round((this.settings.time.scheduleSunrise - Math.trunc(this.settings.time.scheduleSunrise)) * 60);
scheduleManualScheduleTimesSunriseMinutesSpin.connect('output', () => {
const text = scheduleManualScheduleTimesSunriseMinutesSpin.adjustment.value.toString().padStart(2, '0');
scheduleManualScheduleTimesSunriseMinutesSpin.set_text(text);
return true;
});
scheduleManualScheduleTimesSunriseMinutesSpin.connect('value-changed', () => {
const hour = Math.trunc(this.settings.get_double('schedule-sunrise'));
const hour = Math.trunc(this.settings.time.scheduleSunrise);
const newMinutes = scheduleManualScheduleTimesSunriseMinutesSpin.value / 60;
const newTime = hour + newMinutes;
this.settings.set_double('schedule-sunrise', newTime);
this.settings.time.scheduleSunrise = newTime;
});
const scheduleManualScheduleTimesSunsetHoursSpin = this.builder.get_object('prefs_schedule_manual_schedule_times_sunset_hours_spin');
scheduleManualScheduleTimesSunsetHoursSpin.value = Math.trunc(this.settings.get_double('schedule-sunset'));
scheduleManualScheduleTimesSunsetHoursSpin.value = Math.trunc(this.settings.time.scheduleSunset);
scheduleManualScheduleTimesSunsetHoursSpin.connect('output', () => {
const text = scheduleManualScheduleTimesSunsetHoursSpin.adjustment.value.toString().padStart(2, '0');
scheduleManualScheduleTimesSunsetHoursSpin.set_text(text);
return true;
});
scheduleManualScheduleTimesSunsetHoursSpin.connect('value-changed', () => {
const oldTime = this.settings.get_double('schedule-sunset');
const oldTime = this.settings.time.scheduleSunset;
const oldHour = Math.trunc(oldTime);
const newMinutes = oldTime - oldHour;
const newTime = scheduleManualScheduleTimesSunsetHoursSpin.value + newMinutes;
this.settings.set_double('schedule-sunset', newTime);
this.settings.time.scheduleSunset = newTime;
});
const scheduleManualScheduleTimesSunsetMinutesSpin = this.builder.get_object('prefs_schedule_manual_schedule_times_sunset_minutes_spin');
scheduleManualScheduleTimesSunsetMinutesSpin.value = Math.round((this.settings.get_double('schedule-sunset') - Math.trunc(this.settings.get_double('schedule-sunset'))) * 60);
scheduleManualScheduleTimesSunsetMinutesSpin.value = Math.round((this.settings.time.scheduleSunset - Math.trunc(this.settings.time.scheduleSunset)) * 60);
scheduleManualScheduleTimesSunsetMinutesSpin.connect('output', () => {
const text = scheduleManualScheduleTimesSunsetMinutesSpin.adjustment.value.toString().padStart(2, '0');
scheduleManualScheduleTimesSunsetMinutesSpin.set_text(text);
return true;
});
scheduleManualScheduleTimesSunsetMinutesSpin.connect('value-changed', () => {
const hour = Math.trunc(this.settings.get_double('schedule-sunset'));
const hour = Math.trunc(this.settings.time.scheduleSunset);
const newMinutes = scheduleManualScheduleTimesSunsetMinutesSpin.value / 60;
const newTime = hour + newMinutes;
this.settings.set_double('schedule-sunset', newTime);
this.settings.time.scheduleSunset = newTime;
});
const scheduleOndemand = this.builder.get_object('prefs_schedule_ondemand');
const updateScheduleOndemandVisibility = () => {
scheduleOndemand.visible = this.settings.get_string('time-source') === 'ondemand';
scheduleOndemand.visible = this.settings.time.timeSource === 'ondemand';
};
this.settings.bind(
this.settings.time.settings.bind(
'manual-time-source',
scheduleOndemand,
'sensitive',
Gio.SettingsBindFlags.DEFAULT
);
this.settings.connect('changed::time-source', () => updateScheduleOndemandVisibility());
this.settings.time.connect('time-source-changed', () => updateScheduleOndemandVisibility());
updateScheduleOndemandVisibility();
const scheduleOndemandShortcutButton = this.builder.get_object('prefs_schedule_ondemand_shortcut_button');
const updateScheduleOndemandShortcutButtonLabel = () => {
const label = this.settings.get_strv('nightthemeswitcher-ondemand-keybinding')[0];
const label = this.settings.time.ondemandKeybinding;
scheduleOndemandShortcutButton.label = label || _('Choose');
};
this.settings.connect('changed::nightthemeswitcher-ondemand-keybinding', () => updateScheduleOndemandShortcutButtonLabel());
this.settings.time.connect('ondemand-keybinding-changed', () => updateScheduleOndemandShortcutButtonLabel());
scheduleOndemandShortcutButton.connect('clicked', () => {
const dialog = this.builder.get_object('ondemand_keyboard_shortcut_dialog');
dialog.set_transient_for(this.widget.get_toplevel());
@@ -236,16 +239,16 @@ const Preferences = class {
const scheduleOndemandShortcutClearButton = this.builder.get_object('prefs_schedule_ondemand_shortcut_clear_button');
scheduleOndemandShortcutClearButton.connect('clicked', () => {
this.settings.set_strv('nightthemeswitcher-ondemand-keybinding', ['']);
this.settings.time.ondemandKeybinding = '';
});
const updateScheduleOndemandShortcutClearButtonVisibility = () => {
scheduleOndemandShortcutClearButton.visible = !!this.settings.get_strv('nightthemeswitcher-ondemand-keybinding')[0];
scheduleOndemandShortcutClearButton.visible = !!this.settings.time.ondemandKeybinding;
};
this.settings.connect('changed::nightthemeswitcher-ondemand-keybinding', () => updateScheduleOndemandShortcutClearButtonVisibility());
this.settings.time.connect('ondemand-keybinding-changed', () => updateScheduleOndemandShortcutClearButtonVisibility());
updateScheduleOndemandShortcutClearButtonVisibility();
const scheduleOndemandButtonPlacementCombo = this.builder.get_object('prefs_schedule_ondemand_button_placement_combo');
this.settings.bind(
this.settings.time.settings.bind(
'ondemand-button-placement',
scheduleOndemandButtonPlacementCombo,
'active-id',
@@ -255,24 +258,24 @@ const Preferences = class {
_connectGtkThemePreferences() {
const gtkThemeSwitchVariantsSwitch = this.builder.get_object('prefs_gtk_theme_switch_variants_switch');
this.settings.bind(
'gtk-variants-enabled',
this.settings.gtkVariants.settings.bind(
'enabled',
gtkThemeSwitchVariantsSwitch,
'active',
Gio.SettingsBindFlags.DEFAULT
);
const gtkThemeManualVariants = this.builder.get_object('prefs_gtk_theme_manual_variants');
this.settings.bind(
'gtk-variants-enabled',
this.settings.gtkVariants.settings.bind(
'enabled',
gtkThemeManualVariants,
'sensitive',
Gio.SettingsBindFlags.DEFAULT
);
const gtkThemeManualVariantsSwitch = this.builder.get_object('prefs_gtk_theme_manual_variants_switch');
this.settings.bind(
'manual-gtk-variants',
this.settings.gtkVariants.settings.bind(
'manual',
gtkThemeManualVariantsSwitch,
'active',
Gio.SettingsBindFlags.DEFAULT
@@ -280,10 +283,10 @@ const Preferences = class {
const gtkThemeVariants = this.builder.get_object('prefs_gtk_theme_variants');
const updateGtkThemeVariantsSensitivity = () => {
gtkThemeVariants.sensitive = !!(this.settings.get_boolean('gtk-variants-enabled') && this.settings.get_boolean('manual-gtk-variants'));
gtkThemeVariants.sensitive = !!(this.settings.gtkVariants.enabled && this.settings.gtkVariants.manual);
};
this.settings.connect('changed::gtk-variants-enabled', () => updateGtkThemeVariantsSensitivity());
this.settings.connect('changed::manual-gtk-variants', () => updateGtkThemeVariantsSensitivity());
this.settings.gtkVariants.connect('status-changed', () => updateGtkThemeVariantsSensitivity());
this.settings.gtkVariants.connect('manual-changed', () => updateGtkThemeVariantsSensitivity());
updateGtkThemeVariantsSensitivity();
const gtkThemeVariantsDayCombo = this.builder.get_object('prefs_gtk_theme_variants_day_combo');
@@ -293,14 +296,14 @@ const Preferences = class {
gtkThemeVariantsDayCombo.append(theme, theme);
gtkThemeVariantsNightCombo.append(theme, theme);
});
this.settings.bind(
'gtk-variant-day',
this.settings.gtkVariants.settings.bind(
'day',
gtkThemeVariantsDayCombo,
'active-id',
Gio.SettingsBindFlags.DEFAULT
);
this.settings.bind(
'gtk-variant-night',
this.settings.gtkVariants.settings.bind(
'night',
gtkThemeVariantsNightCombo,
'active-id',
Gio.SettingsBindFlags.DEFAULT
@@ -309,24 +312,24 @@ const Preferences = class {
_connectShellThemePreferences() {
const shellThemeSwitchVariantsSwitch = this.builder.get_object('prefs_shell_theme_switch_variants_switch');
this.settings.bind(
'shell-variants-enabled',
this.settings.shellVariants.settings.bind(
'enabled',
shellThemeSwitchVariantsSwitch,
'active',
Gio.SettingsBindFlags.DEFAULT
);
const shellThemeManualVariants = this.builder.get_object('prefs_shell_theme_manual_variants');
this.settings.bind(
'shell-variants-enabled',
this.settings.shellVariants.settings.bind(
'enabled',
shellThemeManualVariants,
'sensitive',
Gio.SettingsBindFlags.DEFAULT
);
const shellThemeManualVariantsSwitch = this.builder.get_object('prefs_shell_theme_manual_variants_switch');
this.settings.bind(
'manual-shell-variants',
this.settings.shellVariants.settings.bind(
'manual',
shellThemeManualVariantsSwitch,
'active',
Gio.SettingsBindFlags.DEFAULT
@@ -334,10 +337,10 @@ const Preferences = class {
const shellThemeVariants = this.builder.get_object('prefs_shell_theme_variants');
const updateShellThemeVariantsSensitivity = () => {
shellThemeVariants.sensitive = !!(this.settings.get_boolean('shell-variants-enabled') && this.settings.get_boolean('manual-shell-variants'));
shellThemeVariants.sensitive = !!(this.settings.shellVariants.enabled && this.settings.shellVariants.manual);
};
this.settings.connect('changed::shell-variants-enabled', () => updateShellThemeVariantsSensitivity());
this.settings.connect('changed::manual-shell-variants', () => updateShellThemeVariantsSensitivity());
this.settings.shellVariants.connect('status-changed', () => updateShellThemeVariantsSensitivity());
this.settings.shellVariants.connect('manual-changed', () => updateShellThemeVariantsSensitivity());
updateShellThemeVariantsSensitivity();
const shellThemeVariantsDayCombo = this.builder.get_object('prefs_shell_theme_variants_day_combo');
@@ -348,14 +351,14 @@ const Preferences = class {
shellThemeVariantsDayCombo.append(theme, themeName);
shellThemeVariantsNightCombo.append(theme, themeName);
});
this.settings.bind(
'shell-variant-day',
this.settings.shellVariants.settings.bind(
'day',
shellThemeVariantsDayCombo,
'active-id',
Gio.SettingsBindFlags.DEFAULT
);
this.settings.bind(
'shell-variant-night',
this.settings.shellVariants.settings.bind(
'night',
shellThemeVariantsNightCombo,
'active-id',
Gio.SettingsBindFlags.DEFAULT
@@ -364,16 +367,16 @@ const Preferences = class {
_connectIconThemePreferences() {
const iconThemeSwitchVariantsSwitch = this.builder.get_object('prefs_icon_theme_switch_variants_switch');
this.settings.bind(
'icon-variants-enabled',
this.settings.iconVariants.settings.bind(
'enabled',
iconThemeSwitchVariantsSwitch,
'active',
Gio.SettingsBindFlags.DEFAULT
);
const iconThemeVariants = this.builder.get_object('prefs_icon_theme_variants');
this.settings.bind(
'icon-variants-enabled',
this.settings.iconVariants.settings.bind(
'enabled',
iconThemeVariants,
'sensitive',
Gio.SettingsBindFlags.DEFAULT
@@ -386,14 +389,14 @@ const Preferences = class {
iconThemeVariantsDayCombo.append(theme, theme);
iconThemeVariantsNightCombo.append(theme, theme);
});
this.settings.bind(
'icon-variant-day',
this.settings.iconVariants.settings.bind(
'day',
iconThemeVariantsDayCombo,
'active-id',
Gio.SettingsBindFlags.DEFAULT
);
this.settings.bind(
'icon-variant-night',
this.settings.iconVariants.settings.bind(
'night',
iconThemeVariantsNightCombo,
'active-id',
Gio.SettingsBindFlags.DEFAULT
@@ -402,16 +405,16 @@ const Preferences = class {
_connectCursorThemePreferences() {
const cursorThemeSwitchVariantsSwitch = this.builder.get_object('prefs_cursor_theme_switch_variants_switch');
this.settings.bind(
'cursor-variants-enabled',
this.settings.cursorVariants.settings.bind(
'enabled',
cursorThemeSwitchVariantsSwitch,
'active',
Gio.SettingsBindFlags.DEFAULT
);
const cursorThemeVariants = this.builder.get_object('prefs_cursor_theme_variants');
this.settings.bind(
'cursor-variants-enabled',
this.settings.cursorVariants.settings.bind(
'enabled',
cursorThemeVariants,
'sensitive',
Gio.SettingsBindFlags.DEFAULT
@@ -424,14 +427,14 @@ const Preferences = class {
cursorThemeVariantsDayCombo.append(theme, theme);
cursorThemeVariantsNightCombo.append(theme, theme);
});
this.settings.bind(
'cursor-variant-day',
this.settings.cursorVariants.settings.bind(
'day',
cursorThemeVariantsDayCombo,
'active-id',
Gio.SettingsBindFlags.DEFAULT
);
this.settings.bind(
'cursor-variant-night',
this.settings.cursorVariants.settings.bind(
'night',
cursorThemeVariantsNightCombo,
'active-id',
Gio.SettingsBindFlags.DEFAULT
@@ -440,16 +443,16 @@ const Preferences = class {
_connectBackgroundPreferences() {
const backgroundSwitchBackgroundsSwitch = this.builder.get_object('prefs_backgrounds_switch_backgrounds_switch');
this.settings.bind(
'backgrounds-enabled',
this.settings.backgrounds.settings.bind(
'enabled',
backgroundSwitchBackgroundsSwitch,
'active',
Gio.SettingsBindFlags.DEFAULT
);
const backgroundsBackgrounds = this.builder.get_object('prefs_backgrounds_backgrounds');
this.settings.bind(
'backgrounds-enabled',
this.settings.backgrounds.settings.bind(
'enabled',
backgroundsBackgrounds,
'sensitive',
Gio.SettingsBindFlags.DEFAULT
@@ -458,9 +461,9 @@ const Preferences = class {
const backgroundsBackgroundsDayBackgroundButton = this.builder.get_object('prefs_backgrounds_backgrounds_day_background_button');
const dayBackgroundPreview = this.builder.get_object('day_background_preview');
const updateBackgroundsBackgroundsDayBackgroundButtonUri = () => {
backgroundsBackgroundsDayBackgroundButton.set_uri(this.settings.get_string('background-day'));
backgroundsBackgroundsDayBackgroundButton.set_uri(this.settings.backgrounds.day);
};
this.settings.connect('changed::background-day', () => updateBackgroundsBackgroundsDayBackgroundButtonUri());
this.settings.backgrounds.connect('day-changed', () => updateBackgroundsBackgroundsDayBackgroundButtonUri());
backgroundsBackgroundsDayBackgroundButton.connect('update-preview', () => {
const file = backgroundsBackgroundsDayBackgroundButton.get_preview_filename();
const allowedContentTypes = ['image/jpeg', 'image/png', 'image/tiff'];
@@ -470,26 +473,26 @@ const Preferences = class {
}
});
backgroundsBackgroundsDayBackgroundButton.connect('file-set', () => {
this.settings.set_string('background-day', backgroundsBackgroundsDayBackgroundButton.get_uri());
this.settings.backgrounds.day = backgroundsBackgroundsDayBackgroundButton.get_uri();
});
updateBackgroundsBackgroundsDayBackgroundButtonUri();
const backgroundsBackgroundsDayBackgroundClearButton = this.builder.get_object('prefs_backgrounds_backgrounds_day_background_clear_button');
backgroundsBackgroundsDayBackgroundClearButton.connect('clicked', () => {
this.settings.set_string('background-day', '');
this.settings.backgrounds.day = '';
});
const updateBackgroundsBackgroundsDayBackgroundClearButtonSensitivity = () => {
backgroundsBackgroundsDayBackgroundClearButton.sensitive = !!this.settings.get_string('background-day');
backgroundsBackgroundsDayBackgroundClearButton.sensitive = !!this.settings.backgrounds.day;
};
this.settings.connect('changed::background-day', () => updateBackgroundsBackgroundsDayBackgroundClearButtonSensitivity());
this.settings.backgrounds.connect('day-changed', () => updateBackgroundsBackgroundsDayBackgroundClearButtonSensitivity());
updateBackgroundsBackgroundsDayBackgroundClearButtonSensitivity();
const backgroundsBackgroundsNightBackgroundButton = this.builder.get_object('prefs_backgrounds_backgrounds_night_background_button');
const nightBackgroundPreview = this.builder.get_object('night_background_preview');
const updateBackgroundsBackgroundsNightBackgroundButtonUri = () => {
backgroundsBackgroundsNightBackgroundButton.set_uri(this.settings.get_string('background-night'));
backgroundsBackgroundsNightBackgroundButton.set_uri(this.settings.backgrounds.night);
};
this.settings.connect('changed::background-night', () => updateBackgroundsBackgroundsNightBackgroundButtonUri());
this.settings.backgrounds.connect('night-changed', () => updateBackgroundsBackgroundsNightBackgroundButtonUri());
backgroundsBackgroundsNightBackgroundButton.connect('update-preview', () => {
const file = backgroundsBackgroundsNightBackgroundButton.get_preview_filename();
const allowedContentTypes = ['image/jpeg', 'image/png', 'image/tiff'];
@@ -499,41 +502,41 @@ const Preferences = class {
}
});
backgroundsBackgroundsNightBackgroundButton.connect('file-set', () => {
this.settings.set_string('background-night', backgroundsBackgroundsNightBackgroundButton.get_uri());
this.settings.backgrounds.night = backgroundsBackgroundsNightBackgroundButton.get_uri();
});
updateBackgroundsBackgroundsNightBackgroundButtonUri();
const backgroundsBackgroundsNightBackgroundClearButton = this.builder.get_object('prefs_backgrounds_backgrounds_night_background_clear_button');
backgroundsBackgroundsNightBackgroundClearButton.connect('clicked', () => {
this.settings.set_string('background-night', '');
this.settings.backgrounds.night = '';
});
const updateBackgroundsBackgroundsNightBackgroundClearButtonSensitivity = () => {
backgroundsBackgroundsNightBackgroundClearButton.sensitive = !!this.settings.get_string('background-night');
backgroundsBackgroundsNightBackgroundClearButton.sensitive = !!this.settings.backgrounds.night;
};
this.settings.connect('changed::background-night', () => updateBackgroundsBackgroundsNightBackgroundClearButtonSensitivity());
this.settings.backgrounds.connect('night-changed', () => updateBackgroundsBackgroundsNightBackgroundClearButtonSensitivity());
updateBackgroundsBackgroundsNightBackgroundClearButtonSensitivity();
}
_connectCommandsPreferences() {
const commandsSwitchCommandsSwitch = this.builder.get_object('prefs_commands_switch_commands_switch');
this.settings.bind(
'commands-enabled',
this.settings.commands.settings.bind(
'enabled',
commandsSwitchCommandsSwitch,
'active',
Gio.SettingsBindFlags.DEFAULT
);
const commandsCommands = this.builder.get_object('prefs_commands_commands');
this.settings.bind(
'commands-enabled',
this.settings.commands.settings.bind(
'enabled',
commandsCommands,
'sensitive',
Gio.SettingsBindFlags.DEFAULT
);
const commandsCommandsSunriseCommandEntry = this.builder.get_object('prefs_commands_commands_sunrise_command_entry');
this.settings.bind(
'command-sunrise',
this.settings.commands.settings.bind(
'sunrise',
commandsCommandsSunriseCommandEntry,
'text',
Gio.SettingsBindFlags.DEFAULT
@@ -541,17 +544,17 @@ const Preferences = class {
const commandsCommandsSunriseCommandClearButton = this.builder.get_object('prefs_commands_commands_sunrise_command_clear_button');
commandsCommandsSunriseCommandClearButton.connect('clicked', () => {
this.settings.set_string('command-sunrise', '');
this.settings.commands.sunrise = '';
});
const updateCommandsCommandsSunriseCommandClearButtonSensitivity = () => {
commandsCommandsSunriseCommandClearButton.sensitive = !!this.settings.get_string('command-sunrise');
commandsCommandsSunriseCommandClearButton.sensitive = !!this.settings.commands.sunrise;
};
this.settings.connect('changed::command-sunrise', () => updateCommandsCommandsSunriseCommandClearButtonSensitivity());
this.settings.commands.connect('sunrise-changed', () => updateCommandsCommandsSunriseCommandClearButtonSensitivity());
updateCommandsCommandsSunriseCommandClearButtonSensitivity();
const commandsCommandsSunsetCommandEntry = this.builder.get_object('prefs_commands_commands_sunset_command_entry');
this.settings.bind(
'command-sunset',
this.settings.commands.settings.bind(
'sunset',
commandsCommandsSunsetCommandEntry,
'text',
Gio.SettingsBindFlags.DEFAULT
@@ -559,12 +562,12 @@ const Preferences = class {
const commandsCommandsSunsetCommandClearButton = this.builder.get_object('prefs_commands_commands_sunset_command_clear_button');
commandsCommandsSunsetCommandClearButton.connect('clicked', () => {
this.settings.set_string('command-sunset', '');
this.settings.commands.sunset = '';
});
const updateCommandsCommandsSunsetCommandClearButtonSensitivity = () => {
commandsCommandsSunsetCommandClearButton.sensitive = !!this.settings.get_string('command-sunset');
commandsCommandsSunsetCommandClearButton.sensitive = !!this.settings.commands.sunset;
};
this.settings.connect('changed::command-sunset', () => updateCommandsCommandsSunsetCommandClearButtonSensitivity());
this.settings.commands.connect('sunset-changed', () => updateCommandsCommandsSunsetCommandClearButtonSensitivity());
updateCommandsCommandsSunsetCommandClearButtonSensitivity();
}
@@ -604,7 +607,7 @@ const Preferences = class {
keycode,
mask
);
this.settings.set_strv('nightthemeswitcher-ondemand-keybinding', [binding]);
this.settings.time.ondemandKeybinding = binding;
ondemandKeyboardShortcutDialog.visible = false;
return Gdk.EVENT_STOP;
});
@@ -1,76 +1,125 @@
<?xml version="1.0" encoding="UTF-8"?>
<schemalist gettext-domain="nightthemeswitcher@romainvigier.fr">
<schema id="org.gnome.shell.extensions.nightthemeswitcher" path="/org/gnome/shell/extensions/nightthemeswitcher/">
<key name="gtk-variants-enabled" type="b">
<key name="settings-version" type="i">
<default>0</default>
<summary>Settings version</summary>
<description>The current extension settings version</description>
</key>
</schema>
<schema id="org.gnome.shell.extensions.nightthemeswitcher.gtk-variants" path="/org/gnome/shell/extensions/nightthemeswitcher/gtk-variants/">
<key name="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">
<key name="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">
<key name="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">
<key name="manual" 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">
</schema>
<schema id="org.gnome.shell.extensions.nightthemeswitcher.shell-variants" path="/org/gnome/shell/extensions/nightthemeswitcher/shell-variants/">
<key name="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">
<key name="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">
<key name="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">
<key name="manual" 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">
</schema>
<schema id="org.gnome.shell.extensions.nightthemeswitcher.icon-variants" path="/org/gnome/shell/extensions/nightthemeswitcher/icon-variants/">
<key name="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">
<key name="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">
<key name="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">
</schema>
<schema id="org.gnome.shell.extensions.nightthemeswitcher.cursor-variants" path="/org/gnome/shell/extensions/nightthemeswitcher/cursor-variants/">
<key name="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">
<key name="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">
<key name="night" type="s">
<default>""</default>
<summary>Night cursor theme</summary>
<description>The cursor theme to use during nighttime</description>
</key>
</schema>
<schema id="org.gnome.shell.extensions.nightthemeswitcher.commands" path="/org/gnome/shell/extensions/nightthemeswitcher/commands/">
<key name="enabled" type="b">
<default>false</default>
<summary>Enable commands</summary>
<description>Commands will be spawned on time change</description>
</key>
<key name="sunrise" type="s">
<default>""</default>
<summary>Sunrise command</summary>
<description>The command to spawn at sunrise</description>
</key>
<key name="sunset" type="s">
<default>""</default>
<summary>Sunset command</summary>
<description>The command to spawn at sunset</description>
</key>
</schema>
<schema id="org.gnome.shell.extensions.nightthemeswitcher.backgrounds" path="/org/gnome/shell/extensions/nightthemeswitcher/backgrounds/">
<key name="enabled" type="b">
<default>false</default>
<summary>Enable backgrounds</summary>
<description>Background will be changed on time change</description>
</key>
<key name="day" type="s">
<default>""</default>
<summary>Day background</summary>
<description>Path to the day background</description>
</key>
<key name="night" type="s">
<default>""</default>
<summary>Night background</summary>
<description>Path to the night background</description>
</key>
</schema>
<schema id="org.gnome.shell.extensions.nightthemeswitcher.time" path="/org/gnome/shell/extensions/nightthemeswitcher/time/">
<key name="time-source" type="s">
<choices>
<choice value="nightlight"/>
@@ -121,35 +170,5 @@
<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>
@@ -0,0 +1,155 @@
<?xml version="1.0" encoding="UTF-8"?>
<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>
+99
View File
@@ -0,0 +1,99 @@
/*
Night Theme Switcher Gnome Shell extension
Copyright (C) 2020 Romain Vigier
This program is free software: you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation, either version 3 of the License, or (at your option) any later
version.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
this program. If not, see <http s ://www.gnu.org/licenses/>.
*/
const { extensionUtils } = imports.misc;
const Signals = imports.signals;
const Me = extensionUtils.getCurrentExtension();
const compat = Me.imports.compat;
const { logDebug, getSettingsSchema } = Me.imports.utils;
var BackgroundsSettings = class {
constructor() {
logDebug('Initializing backgrounds settings...');
this.settings = compat.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);
+99
View File
@@ -0,0 +1,99 @@
/*
Night Theme Switcher Gnome Shell extension
Copyright (C) 2020 Romain Vigier
This program is free software: you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation, either version 3 of the License, or (at your option) any later
version.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
this program. If not, see <http s ://www.gnu.org/licenses/>.
*/
const { extensionUtils } = imports.misc;
const Signals = imports.signals;
const Me = extensionUtils.getCurrentExtension();
const compat = Me.imports.compat;
const { logDebug, getSettingsSchema } = Me.imports.utils;
var CommandsSettings = class {
constructor() {
logDebug('Initializing commands settings...');
this.settings = compat.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);
+101
View File
@@ -0,0 +1,101 @@
/*
Night Theme Switcher Gnome Shell extension
Copyright (C) 2020 Romain Vigier
This program is free software: you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation, either version 3 of the License, or (at your option) any later
version.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
this program. If not, see <http s ://www.gnu.org/licenses/>.
*/
const { extensionUtils } = imports.misc;
const Signals = imports.signals;
const Me = extensionUtils.getCurrentExtension();
const compat = Me.imports.compat;
const { logDebug, getSettingsSchema } = Me.imports.utils;
var CursorVariantsSettings = class {
constructor() {
logDebug('Initializing cursor variants settings...');
this.settings = compat.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);
+117
View File
@@ -0,0 +1,117 @@
/*
Night Theme Switcher Gnome Shell extension
Copyright (C) 2020 Romain Vigier
This program is free software: you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation, either version 3 of the License, or (at your option) any later
version.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
this program. If not, see <http s ://www.gnu.org/licenses/>.
*/
const { extensionUtils } = imports.misc;
const Signals = imports.signals;
const Me = extensionUtils.getCurrentExtension();
const compat = Me.imports.compat;
const { logDebug, getSettingsSchema } = Me.imports.utils;
var GtkVariantsSettings = class {
constructor() {
logDebug('Initializing GTK variants settings...');
this.settings = compat.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);
+101
View File
@@ -0,0 +1,101 @@
/*
Night Theme Switcher Gnome Shell extension
Copyright (C) 2020 Romain Vigier
This program is free software: you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation, either version 3 of the License, or (at your option) any later
version.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
this program. If not, see <http s ://www.gnu.org/licenses/>.
*/
const { extensionUtils } = imports.misc;
const Signals = imports.signals;
const Me = extensionUtils.getCurrentExtension();
const compat = Me.imports.compat;
const { logDebug, getSettingsSchema } = Me.imports.utils;
var IconVariantsSettings = class {
constructor() {
logDebug('Initializing icon variants settings...');
this.settings = compat.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);
+95
View File
@@ -0,0 +1,95 @@
/*
Night Theme Switcher Gnome Shell extension
Copyright (C) 2020 Romain Vigier
This program is free software: you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation, either version 3 of the License, or (at your option) any later
version.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
this program. If not, see <http s ://www.gnu.org/licenses/>.
*/
const { extensionUtils } = imports.misc;
const Me = extensionUtils.getCurrentExtension();
const compat = Me.imports.compat;
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 = compat.getExtensionSettings();
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);
}
}
}
};
+117
View File
@@ -0,0 +1,117 @@
/*
Night Theme Switcher Gnome Shell extension
Copyright (C) 2020 Romain Vigier
This program is free software: you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation, either version 3 of the License, or (at your option) any later
version.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
this program. If not, see <http s ://www.gnu.org/licenses/>.
*/
const { extensionUtils } = imports.misc;
const Signals = imports.signals;
const Me = extensionUtils.getCurrentExtension();
const compat = Me.imports.compat;
const { logDebug, getSettingsSchema } = Me.imports.utils;
var ShellVariantsSettings = class {
constructor() {
logDebug('Initializing shell variants settings...');
this.settings = compat.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);
+177
View File
@@ -0,0 +1,177 @@
/*
Night Theme Switcher Gnome Shell extension
Copyright (C) 2020 Romain Vigier
This program is free software: you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation, either version 3 of the License, or (at your option) any later
version.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
this program. If not, see <http s ://www.gnu.org/licenses/>.
*/
const { Gio } = imports.gi;
const { extensionUtils } = imports.misc;
const Signals = imports.signals;
const Me = extensionUtils.getCurrentExtension();
const compat = Me.imports.compat;
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);
+147
View File
@@ -0,0 +1,147 @@
/*
Night Theme Switcher Gnome Shell extension
Copyright (C) 2020 Romain Vigier
This program is free software: you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation, either version 3 of the License, or (at your option) any later
version.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
this program. If not, see <http s ://www.gnu.org/licenses/>.
*/
const { extensionUtils } = imports.misc;
const Signals = imports.signals;
const Me = extensionUtils.getCurrentExtension();
const compat = Me.imports.compat;
const { logDebug, getSettingsSchema } = Me.imports.utils;
var TimeSettings = class {
constructor() {
logDebug('Initializing time settings...');
this.settings = compat.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._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._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 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);
}
_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);
+63
View File
@@ -0,0 +1,63 @@
/*
Night Theme Switcher Gnome Shell extension
Copyright (C) 2020 Romain Vigier
This program is free software: you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation, either version 3 of the License, or (at your option) any later
version.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
this program. If not, see <http s ://www.gnu.org/licenses/>.
*/
const { extensionUtils } = imports.misc;
const Me = extensionUtils.getCurrentExtension();
const compat = Me.imports.compat;
const { getSettingsSchema } = Me.imports.utils;
function migrate(settings) {
const oldSettings = compat.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');
}
+9
View File
@@ -47,6 +47,15 @@ function notifyError(error) {
imports.ui.main.notifyError(Me.metadata.name, error.message);
}
/**
* Build the full settings schema from a subschema.
* @param {string} subSchema The subschema to get.
* @returns {string} The full schema.
*/
function getSettingsSchema(subSchema) {
return subSchema ? `${Me.metadata['settings-schema']}.${subSchema}` : Me.metadata['settings-schema'];
}
/**
* Get all the directories of the system for a resource.
* @param {string} resource The resource to get the directories.