From f8ee696c7c92268d407981b5cd3c184bcdc7fdab Mon Sep 17 00:00:00 2001 From: Giovanni Campagna Date: Tue, 20 Nov 2012 16:20:10 +0100 Subject: [PATCH] alternate-tab: port to the new keybindings infrastructure Keybindings were refactored in 3.7.2, to allow handling them while the shell is modal, and now require a set of flags indicating the "allowed modes" --- extensions/alternate-tab/extension.js | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/extensions/alternate-tab/extension.js b/extensions/alternate-tab/extension.js index 9f771ceb..52ddd4e4 100644 --- a/extensions/alternate-tab/extension.js +++ b/extensions/alternate-tab/extension.js @@ -428,16 +428,20 @@ function init(metadata) { settings = Convenience.getSettings(); } +function setKeybinding(name, func) { + Main.wm.setCustomKeybindingHandler(name, Main.KeybindingMode.NORMAL, func); +} + function enable() { - Meta.keybindings_set_custom_handler('switch-windows', doAltTab); - Meta.keybindings_set_custom_handler('switch-group', doAltTab); - Meta.keybindings_set_custom_handler('switch-windows-backward', doAltTab); - Meta.keybindings_set_custom_handler('switch-group-backward', doAltTab); + setKeybinding('switch-windows', doAltTab); + setKeybinding('switch-group', doAltTab); + setKeybinding('switch-windows-backward', doAltTab); + setKeybinding('switch-group-backward', doAltTab); } function disable() { - Meta.keybindings_set_custom_handler('switch-windows', Lang.bind(Main.wm, Main.wm._startAppSwitcher)); - Meta.keybindings_set_custom_handler('switch-group', Lang.bind(Main.wm, Main.wm._startAppSwitcher)); - Meta.keybindings_set_custom_handler('switch-windows-backward', Lang.bind(Main.wm, Main.wm._startAppSwitcher)); - Meta.keybindings_set_custom_handler('switch-group-backward', Lang.bind(Main.wm, Main.wm._startAppSwitcher)); + setKeybinding('switch-windows', Lang.bind(Main.wm, Main.wm._startAppSwitcher)); + setKeybinding('switch-group', Lang.bind(Main.wm, Main.wm._startAppSwitcher)); + setKeybinding('switch-windows-backward', Lang.bind(Main.wm, Main.wm._startAppSwitcher)); + setKeybinding('switch-group-backward', Lang.bind(Main.wm, Main.wm._startAppSwitcher)); }