Add org.gnome.shell.enabled-extensions complementing disabled-extensions
If the former is empty (default), only the extensions not contained in the latter are loaded. Else, all extensions in the former that are not contained in the latter are loaded. https://bugzilla.gnome.org/show_bug.cgi?id=651088
This commit is contained in:
parent
88df183450
commit
33a3b8046d
@ -15,8 +15,18 @@
|
||||
<default>[]</default>
|
||||
<_summary>Uuids of extensions to disable</_summary>
|
||||
<_description>
|
||||
GNOME Shell extensions have a uuid property;
|
||||
this key lists extensions which should not be loaded.
|
||||
GNOME Shell extensions have a uuid property; this key lists extensions
|
||||
which should not be loaded. This setting overrides enabled-extensions
|
||||
for extensions that appear in both lists.
|
||||
</_description>
|
||||
</key>
|
||||
<key name="enabled-extensions" type="as">
|
||||
<default>[]</default>
|
||||
<_summary>Uuids of extensions to enable</_summary>
|
||||
<_description>
|
||||
GNOME Shell extensions have a uuid property; this key lists extensions
|
||||
which should be loaded. disabled-extensions overrides this setting for
|
||||
extensions that appear in both lists.
|
||||
</_description>
|
||||
</key>
|
||||
<key name="enable-app-monitoring" type="b">
|
||||
|
@ -23,8 +23,9 @@ const ExtensionType = {
|
||||
const extensionMeta = {};
|
||||
// Maps uuid -> importer object (extension directory tree)
|
||||
const extensions = {};
|
||||
// Array of uuids
|
||||
// Arrays of uuids
|
||||
var disabledExtensions;
|
||||
var enabledExtensions;
|
||||
// GFile for user extensions
|
||||
var userExtensionsDir = null;
|
||||
|
||||
@ -178,6 +179,7 @@ function init() {
|
||||
}
|
||||
|
||||
disabledExtensions = global.settings.get_strv('disabled-extensions', -1);
|
||||
enabledExtensions = global.settings.get_strv('enabled-extensions', -1);
|
||||
}
|
||||
|
||||
function _loadExtensionsIn(dir, type) {
|
||||
@ -195,7 +197,10 @@ function _loadExtensionsIn(dir, type) {
|
||||
if (fileType != Gio.FileType.DIRECTORY)
|
||||
continue;
|
||||
let name = info.get_name();
|
||||
let enabled = disabledExtensions.indexOf(name) < 0;
|
||||
// Enable all but disabled extensions if enabledExtensions is not set.
|
||||
// If it is set, enable one those, except they are disabled as well.
|
||||
let enabled = (enabledExtensions.length == 0 || enabledExtensions.indexOf(name) >= 0)
|
||||
&& disabledExtensions.indexOf(name) < 0;
|
||||
let child = dir.get_child(name);
|
||||
loadExtension(child, enabled, type);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user