summaryrefslogtreecommitdiffstats
path: root/extensions/45/vertical-workspaces/lib/util.js
diff options
context:
space:
mode:
Diffstat (limited to '')
-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));
}