Pass settings object to killKeybinding

Restoration require the same settings object to be available due to the use of
Map. Indexing on the canonical name of the schema is probably a better solution.
This commit is contained in:
Tor Hedin Brønner
2018-01-10 09:59:10 +01:00
parent 43b26611bd
commit 06ca7eecaa
+22 -8
View File
@@ -23,6 +23,9 @@ let isDuringGnomeShellStartup = false;
window.PaperWM = Extension;
var wmSettings;
var shellSettings;
var paperSettings;
var paperActions;
function init() {
SESSIONID += "#"
@@ -35,6 +38,12 @@ function init() {
}
initCount++;
wmSettings =
new Gio.Settings({ schema_id: "org.gnome.desktop.wm.keybindings"});
shellSettings = new Gio.Settings({ schema_id: "org.gnome.shell.keybindings"});
paperSettings = convenience.getSettings();
/*
Keep track of some mappings mutter doesn't do/expose
- action-name -> action-id mapping
@@ -157,7 +166,6 @@ function restoreKeybindings() {
}
}
var settings;
let nWorkspacesSignal;
let workspaceRemovedSignal;
let windowCreatedSignal;
@@ -197,6 +205,8 @@ function enable() {
initWorkspaces();
}
// Restore settings if we've reloaded
restoreKeybindings(paperSettings);
let settings = new Gio.Settings({ schema_id: "org.gnome.desktop.wm.keybindings"});
@@ -205,13 +215,12 @@ function enable() {
settings.set_strv("toggle-fullscreen", ['<super><shift>f']);
// We want to use
killKeybinding('switch-applications');
killKeybinding('switch-applications-backward');
killKeybinding('switch-group');
killKeybinding('switch-group-backward');
killKeybinding('switch-applications', wmSettings);
killKeybinding('switch-applications-backward', wmSettings);
killKeybinding('switch-group', wmSettings);
killKeybinding('switch-group-backward', wmSettings);
let shell_settings = new Gio.Settings({ schema_id: "org.gnome.shell.keybindings"});
shell_settings.set_strv("toggle-overview", ["<super>space"])
shellSettings.set_strv("toggle-overview", ["<super>space"])
enabled = true;
}
@@ -225,7 +234,12 @@ function disable() {
Tiling.disable();
StackOverlay.disable()
restoreKeybindings();
// Restore default gnome bindings
restoreKeybindings(wmSettings);
// Kill our custom bindings
killKeybinding('live-alt-tab', paperSettings)
killKeybinding('live-alt-tab-backward', paperSettings)
enabled = false;
}