Split settings into different files
This commit is contained in:
+36
-28
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
@@ -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
@@ -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
@@ -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
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
@@ -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
@@ -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
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user