diff --git a/src/modules/SwitcherTheme.js b/src/modules/SwitcherTheme.js index 0a26292..502c513 100644 --- a/src/modules/SwitcherTheme.js +++ b/src/modules/SwitcherTheme.js @@ -3,6 +3,7 @@ const { Gio } = imports.gi; const { extensionUtils } = imports.misc; +const { extensionManager } = imports.ui.main; const Me = extensionUtils.getCurrentExtension(); @@ -71,6 +72,10 @@ var SwitcherTheme = class extends Switcher { super.disable(); } + set systemSettings(settings) { + this.#systemSettings = settings; + } + #connectSettings() { console.debug(`Connecting ${this.#name} switcher to settings...`); this.#settingsConnections.push({ @@ -186,6 +191,7 @@ var SwitcherThemeShell = class extends SwitcherTheme { themeKey: 'name', noSettingsUpdateSystemThemeCallback: time => this.#noSettingsUpdateSystemThemeCallback(time), }); + extensionManager.connect('extension-state-changed', this.#onExtensionStateChanged.bind(this)); this.#settings = settings; } @@ -194,4 +200,8 @@ var SwitcherThemeShell = class extends SwitcherTheme { const stylesheet = utils.getShellThemeStylesheet(shellTheme); utils.applyShellStylesheet(stylesheet); } + + #onExtensionStateChanged() { + this.systemSettings = utils.getUserthemesSettings(); + } }; diff --git a/src/utils.js b/src/utils.js index 8888d1b..17138a1 100644 --- a/src/utils.js +++ b/src/utils.js @@ -9,6 +9,8 @@ const Me = extensionUtils.getCurrentExtension(); const Gettext = imports.gettext.domain(Me.metadata['gettext-domain']); const _ = Gettext.gettext; +const { ExtensionState } = extensionUtils; + /** * Build the full settings schema from a subschema. @@ -153,7 +155,7 @@ function getUserthemesExtension() { */ function getUserthemesSettings() { let extension = getUserthemesExtension(); - if (!extension) + if (!extension || extension.state !== ExtensionState.ENABLED) return null; const schemaDir = extension.dir.get_child('schemas'); const GioSSS = Gio.SettingsSchemaSource;