diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-14 06:15:40 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-14 06:15:40 +0000 |
commit | a7253052777df3bcf4b2abe9367de244cbc35da1 (patch) | |
tree | 1168b662d8028f172d12c2eb4efc62bf8408434b /extensions/46/vertical-workspaces/lib/util.js | |
parent | Adding upstream version 20231210. (diff) | |
download | gnome-shell-extensions-extra-upstream/20240414.tar.xz gnome-shell-extensions-extra-upstream/20240414.zip |
Adding upstream version 20240414.upstream/20240414upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | extensions/46/vertical-workspaces/lib/util.js (renamed from extensions/45/vertical-workspaces/lib/util.js) | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/extensions/45/vertical-workspaces/lib/util.js b/extensions/46/vertical-workspaces/lib/util.js index 38ca6cd..ab79c48 100644 --- a/extensions/45/vertical-workspaces/lib/util.js +++ b/extensions/46/vertical-workspaces/lib/util.js @@ -3,7 +3,7 @@ * util.js * * @author GdH <G-dH@github.com> - * @copyright 2022 - 2023 + * @copyright 2022 - 2024 * @license GPL-3.0 * */ @@ -285,9 +285,9 @@ export function isMoreRelevant(stringA, stringB, pattern) { export function getEnabledExtensions(pattern = '') { let result = []; - // extensionManager is unreliable at startup (if not all extensions were loaded) - // but gsettings key can contain removed extensions... - // therefore we have to look into filesystem, what's really installed + // extensionManager is unreliable at startup because it is uncertain whether all extensions have been loaded + // also gsettings key can contain already removed extensions (user deleted them without disabling them first) + // therefore we have to check what's really installed in the filesystem if (!_installedExtensions) { const extensionFiles = [...collectFromDatadirs('extensions', true)]; _installedExtensions = extensionFiles.map(({ info }) => { @@ -298,8 +298,19 @@ export function getEnabledExtensions(pattern = '') { return uuid; }); } + // _enabledExtensions contains content of the enabled-extensions key from gsettings, not actual state const enabled = Main.extensionManager._enabledExtensions; result = _installedExtensions.filter(ext => enabled.includes(ext)); + // _extensions contains already loaded extensions, so we can try to filter out broken or incompatible extensions + const active = Main.extensionManager._extensions; + result = result.filter(ext => { + const extension = active.get(ext); + if (extension) + return ![3, 4].includes(extension.state); // 3 - ERROR, 4 - OUT_OF_TIME (not supported by shell-version in metadata) + // extension can be enabled but not yet loaded, we just cannot see its state at this moment, so let it pass as enabled + return true; + }); + // return only extensions matching the search pattern return result.filter(uuid => uuid !== null && uuid.includes(pattern)); } |