summaryrefslogtreecommitdiffstats
path: root/extensions/45/vertical-workspaces/lib/util.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-14 06:06:59 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-14 06:07:20 +0000
commit291a94173c5ea022f75b4eee07e6e0c97a04ff7a (patch)
tree1b830db26b458dec134c75bfc3fcaf2ddcceb149 /extensions/45/vertical-workspaces/lib/util.js
parentUpdating 45/no-overview to version 46 [85eba64]. (diff)
downloadgnome-shell-extensions-extra-291a94173c5ea022f75b4eee07e6e0c97a04ff7a.tar.xz
gnome-shell-extensions-extra-291a94173c5ea022f75b4eee07e6e0c97a04ff7a.zip
Adding 45/vertical-workspaces version 37+20240412 [9b05a79].
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'extensions/45/vertical-workspaces/lib/util.js')
-rw-r--r--extensions/45/vertical-workspaces/lib/util.js19
1 files changed, 15 insertions, 4 deletions
diff --git a/extensions/45/vertical-workspaces/lib/util.js b/extensions/45/vertical-workspaces/lib/util.js
index 38ca6cd..ab79c48 100644
--- a/extensions/45/vertical-workspaces/lib/util.js
+++ b/extensions/45/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));
}