extensionSystem: Add kill-switch setting to disable user extensions
When gnome-shell fails to start on login, gnome-session tries to re-launch it again with all extensions disabled. This is currently implemented by clearing the list of enabled extensions, which means the user needs to re-enable their extensions manually again. To make this process less annoying, add a single 'kill-switch' setting gnome-session can use without interfering with the user setting. https://bugzilla.gnome.org/show_bug.cgi?id=778664
This commit is contained in:
parent
2c070d38fb
commit
7395aaf9b4
@ -21,6 +21,14 @@
|
|||||||
EnableExtension and DisableExtension D-Bus methods on org.gnome.Shell.
|
EnableExtension and DisableExtension D-Bus methods on org.gnome.Shell.
|
||||||
</description>
|
</description>
|
||||||
</key>
|
</key>
|
||||||
|
<key name="disable-user-extensions" type="b">
|
||||||
|
<default>false</default>
|
||||||
|
<summary>Disable user extensions</summary>
|
||||||
|
<description>
|
||||||
|
Disable all extensions the user has enabled without affecting
|
||||||
|
the 'enabled-extension' setting.
|
||||||
|
</description>
|
||||||
|
</key>
|
||||||
<key name="disable-extension-version-validation" type="b">
|
<key name="disable-extension-version-validation" type="b">
|
||||||
<default>true</default>
|
<default>true</default>
|
||||||
<summary>Disables the validation of extension version compatibility</summary>
|
<summary>Disables the validation of extension version compatibility</summary>
|
||||||
|
@ -38,6 +38,7 @@ const connect = Lang.bind(_signals, _signals.connect);
|
|||||||
const disconnect = Lang.bind(_signals, _signals.disconnect);
|
const disconnect = Lang.bind(_signals, _signals.disconnect);
|
||||||
|
|
||||||
const ENABLED_EXTENSIONS_KEY = 'enabled-extensions';
|
const ENABLED_EXTENSIONS_KEY = 'enabled-extensions';
|
||||||
|
const DISABLE_USER_EXTENSIONS_KEY = 'disable-user-extensions';
|
||||||
const EXTENSION_DISABLE_VERSION_CHECK_KEY = 'disable-extension-version-validation';
|
const EXTENSION_DISABLE_VERSION_CHECK_KEY = 'disable-extension-version-validation';
|
||||||
|
|
||||||
var initted = false;
|
var initted = false;
|
||||||
@ -238,11 +239,16 @@ function initExtension(uuid) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getEnabledExtensions() {
|
function getEnabledExtensions() {
|
||||||
let extensions = global.settings.get_strv(ENABLED_EXTENSIONS_KEY);
|
let extensions;
|
||||||
if (!Array.isArray(Main.sessionMode.enabledExtensions))
|
if (Array.isArray(Main.sessionMode.enabledExtensions))
|
||||||
|
extensions = Main.sessionMode.enabledExtensions;
|
||||||
|
else
|
||||||
|
extensions = [];
|
||||||
|
|
||||||
|
if (global.settings.get_boolean(DISABLE_USER_EXTENSIONS_KEY))
|
||||||
return extensions;
|
return extensions;
|
||||||
|
|
||||||
return Main.sessionMode.enabledExtensions.concat(extensions);
|
return extensions.concat(global.settings.get_strv(ENABLED_EXTENSIONS_KEY));
|
||||||
}
|
}
|
||||||
|
|
||||||
function onEnabledExtensionsChanged() {
|
function onEnabledExtensionsChanged() {
|
||||||
@ -288,6 +294,7 @@ function _onVersionValidationChanged() {
|
|||||||
|
|
||||||
function _loadExtensions() {
|
function _loadExtensions() {
|
||||||
global.settings.connect('changed::' + ENABLED_EXTENSIONS_KEY, onEnabledExtensionsChanged);
|
global.settings.connect('changed::' + ENABLED_EXTENSIONS_KEY, onEnabledExtensionsChanged);
|
||||||
|
global.settings.connect('changed::' + DISABLE_USER_EXTENSIONS_KEY, onEnabledExtensionsChanged);
|
||||||
global.settings.connect('changed::' + EXTENSION_DISABLE_VERSION_CHECK_KEY, _onVersionValidationChanged);
|
global.settings.connect('changed::' + EXTENSION_DISABLE_VERSION_CHECK_KEY, _onVersionValidationChanged);
|
||||||
|
|
||||||
enabledExtensions = getEnabledExtensions();
|
enabledExtensions = getEnabledExtensions();
|
||||||
|
Loading…
Reference in New Issue
Block a user