diff --git a/extension.js b/extension.js index ef33fd3..a5fbb18 100644 --- a/extension.js +++ b/extension.js @@ -189,6 +189,10 @@ function restoreKeybindings() { } } +function setKeybinding(name, func) { + Main.wm.setCustomKeybindingHandler(name, Shell.ActionMode.NORMAL, func); +} + let nWorkspacesSignal; let workspaceRemovedSignal; let windowCreatedSignal; @@ -210,13 +214,21 @@ function enable() { settings.set_strv("maximize-horizontally", ['f']) settings.set_strv("toggle-fullscreen", ['f']); - // We want to use - killKeybinding('switch-applications', wmSettings); - killKeybinding('switch-applications-backward', wmSettings); - killKeybinding('switch-group', wmSettings); - killKeybinding('switch-group-backward', wmSettings); - // Super-n is used for new-window - killKeybinding('focus-active-notification', shellSettings); + setKeybinding('switch-applications', + utils.dynamic_function_ref('liveAltTab', + LiveAltTab)); + setKeybinding('switch-applications-backward', + utils.dynamic_function_ref('liveAltTab', + LiveAltTab)); + setKeybinding('switch-group', + utils.dynamic_function_ref("preview_navigate", + Navigator)); + setKeybinding('switch-group-backward', + utils.dynamic_function_ref("preview_navigate", + Navigator)); + + setKeybinding('focus-active-notification', // `N` + utils.as_key_handler('newWindow', App)); // Switched to 'escape' in 3.28 killKeybinding('restore-shortcuts', new Gio.Settings({ schema_id: "org.gnome.mutter.wayland.keybindings"})); @@ -234,15 +246,22 @@ function disable() { debug("disable", SESSIONID); // Disconnect focus and reset scale and pivot + setKeybinding('switch-applications', + Main.wm._startSwitcher.bind(Main.wm)); + setKeybinding('switch-applications-backward', + Main.wm._startSwitcher.bind(Main.wm)); + setKeybinding('switch-group', + Main.wm._startSwitcher.bind(Main.wm)); + setKeybinding('switch-group-backward', + Main.wm._startSwitcher.bind(Main.wm)); + + Main.wm.setCustomKeybindingHandler('focus-active-notification', + Shell.ActionMode.NORMAL | + Shell.ActionMode.OVERVIEW, + Main.messageTray._expandActiveNotification.bind(Main.messageTray)); + modules.forEach(m => m.disable && m.disable()); - // Restore default gnome bindings - // restoreKeybindings(wmSettings); - - // Kill our custom bindings - // killKeybinding('live-alt-tab', paperSettings) - // killKeybinding('live-alt-tab-backward', paperSettings) - enabled = false; } diff --git a/navigator.js b/navigator.js index c9e93f4..816a765 100644 --- a/navigator.js +++ b/navigator.js @@ -213,6 +213,16 @@ var PreviewedWindowNavigator = new Lang.Class({ _doAction: function(mutterActionId) { let paperActions = Extension.imports.extension.paperActions; + + switch (mutterActionId) { + case Meta.KeyBindingAction.SWITCH_GROUP: + mutterActionId = paperActions.idOf('previous-workspace'); + break; + case Meta.KeyBindingAction.SWITCH_GROUP_BACKWARD: + mutterActionId = paperActions.idOf('previous-workspace-backward'); + break; + } + if (mutterActionId === paperActions.idOf("switch-next")) { this._select(this._next()); return true; diff --git a/schemas/gschemas.compiled b/schemas/gschemas.compiled index 4b7a1d5..00a134c 100644 Binary files a/schemas/gschemas.compiled and b/schemas/gschemas.compiled differ diff --git a/schemas/org.gnome.shell.extensions.org-scrollwm.gschema.xml b/schemas/org.gnome.shell.extensions.org-scrollwm.gschema.xml index f030590..ef83e7b 100644 --- a/schemas/org.gnome.shell.extensions.org-scrollwm.gschema.xml +++ b/schemas/org.gnome.shell.extensions.org-scrollwm.gschema.xml @@ -23,20 +23,20 @@ - Tab']]]> + Switch to previously used window - Tab']]]> + Switch to previously used window, backward order - d', 'Above_Tab']]]> + d']]]> Switch to previously used workspace - u', 'Above_Tab']]]> + u']]]> Switch to the previously used workspace, backward order