[gnome-shell-extensions] alternateTab: Adjust to gnome-shell changes



commit e98e5d0d6232da905bfec8023fc8ef557893b77d
Author: Florian Müllner <fmuellner gnome org>
Date:   Tue May 31 17:12:20 2016 +0200

    alternateTab: Adjust to gnome-shell changes
    
    The code de-duplication in commit bf8d30603e57b broke the extension,
    fix by duplicating the code here now :-(
    
    (It's not really that bad though ...)
    
    https://bugzilla.gnome.org/show_bug.cgi?id=767077

 extensions/alternate-tab/extension.js |   29 +++++++++++++++++++++--------
 1 files changed, 21 insertions(+), 8 deletions(-)
---
diff --git a/extensions/alternate-tab/extension.js b/extensions/alternate-tab/extension.js
index 79fde0a..7a5ee17 100644
--- a/extensions/alternate-tab/extension.js
+++ b/extensions/alternate-tab/extension.js
@@ -7,6 +7,7 @@ const Shell = imports.gi.Shell;
 
 const AltTab = imports.ui.altTab;
 const Main = imports.ui.main;
+const WindowManager = imports.ui.windowManager;
 
 let injections = {};
 
@@ -33,20 +34,32 @@ function enable() {
         return injections['_keyPressHandler'].call(this, keysym, action);
     };
 
-    setKeybinding('switch-applications', Lang.bind(Main.wm, Main.wm._startWindowSwitcher));
-    setKeybinding('switch-group', Lang.bind(Main.wm, Main.wm._startWindowSwitcher));
-    setKeybinding('switch-applications-backward', Lang.bind(Main.wm, Main.wm._startWindowSwitcher));
-    setKeybinding('switch-group-backward', Lang.bind(Main.wm, Main.wm._startWindowSwitcher));
+    Main.wm._forcedWindowSwitcher = function(display, screen, window, binding) {
+        /* prevent a corner case where both popups show up at once */
+        if (this._workspaceSwitcherPopup != null)
+            this._workspaceSwitcherPopup.destroy();
+
+        let tabPopup = new AltTab.WindowSwitcherPopup();
+
+        if (!tabPopup.show(binding.is_reversed(), binding.get_name(), binding.get_mask()))
+            tabPopup.destroy();
+    };
+
+    setKeybinding('switch-applications', Lang.bind(Main.wm, Main.wm._forcedWindowSwitcher));
+    setKeybinding('switch-group', Lang.bind(Main.wm, Main.wm._forcedWindowSwitcher));
+    setKeybinding('switch-applications-backward', Lang.bind(Main.wm, Main.wm._forcedWindowSwitcher));
+    setKeybinding('switch-group-backward', Lang.bind(Main.wm, Main.wm._forcedWindowSwitcher));
 }
 
 function disable() {
     var prop;
 
-    setKeybinding('switch-applications', Lang.bind(Main.wm, Main.wm._startAppSwitcher));
-    setKeybinding('switch-group', Lang.bind(Main.wm, Main.wm._startAppSwitcher));
-    setKeybinding('switch-applications-backward', Lang.bind(Main.wm, Main.wm._startAppSwitcher));
-    setKeybinding('switch-group-backward', Lang.bind(Main.wm, Main.wm._startAppSwitcher));
+    setKeybinding('switch-applications', Lang.bind(Main.wm, Main.wm._startSwitcher));
+    setKeybinding('switch-group', Lang.bind(Main.wm, Main.wm._startSwitcher));
+    setKeybinding('switch-applications-backward', Lang.bind(Main.wm, Main.wm._startSwitcher));
+    setKeybinding('switch-group-backward', Lang.bind(Main.wm, Main.wm._startSwitcher));
 
     for (prop in injections)
         AltTab.WindowSwitcherPopup.prototype[prop] = injections[prop];
+    delete Main.wm._forcedWindowSwitcher;
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]