diff --git a/js/ui/altTab.js b/js/ui/altTab.js
index ed541b3..82c446c 100644
--- a/js/ui/altTab.js
+++ b/js/ui/altTab.js
@@ -192,6 +192,23 @@ AltTabPopup.prototype = {
         return mod(this._currentApp - 1, this._appIcons.length);
     },
 
+    _nextAppInWorkspace: function() {
+        let activeWorkspace = global.screen.get_active_workspace();
+        let app = this._currentApp;
+        do {
+            app = mod(app + 1, this._appIcons.length);
+        } while (!this._hasWindowsOnWorkspace(this._appIcons[app], activeWorkspace));
+        return app;
+    },
+    _previousAppInWorkspace: function() {
+        let activeWorkspace = global.screen.get_active_workspace();
+        let app = this._currentApp;
+        do {
+            app = mod(app - 1, this._appIcons.length);
+        } while (!this._hasWindowsOnWorkspace(this._appIcons[app], activeWorkspace));
+        return app;
+    },
+
     _nextWindow : function() {
         // We actually want the second window if we're in the unset state
         if (this._currentWindow == -1)
@@ -207,6 +224,31 @@ AltTabPopup.prototype = {
                    this._appIcons[this._currentApp].cachedWindows.length);
     },
 
+    _nextWindowInWorkspace: function() {
+        if (this._currentWindow == -1)
+            this._currentWindow = 0;
+
+        let activeWorkspace = global.screen.get_active_workspace();
+        let window = this._currentWindow;
+        let windows = this._appIcons[this._currentApp].cachedWindows;
+        do {
+            window = mod(window + 1, windows.length);
+        } while (windows[window].get_workspace() != activeWorkspace);
+        return window;
+    },
+    _previousWindowInWorkspace: function() {
+        if (this._currentWindow == -1)
+            this._currentWindow = 0;
+
+        let activeWorkspace = global.screen.get_active_workspace();
+        let window = this._currentWindow;
+        let windows = this._appIcons[this._currentApp].cachedWindows;
+        do {
+            window = mod(window - 1, windows.length);
+        } while (windows[window].get_workspace() != activeWorkspace);
+        return window;
+    },
+
     _keyPressEvent : function(actor, event) {
         let keysym = event.get_key_symbol();
         let event_state = Shell.get_event_state(event);
@@ -216,7 +258,7 @@ AltTabPopup.prototype = {
         this._disableHover();
 
         if (action == Meta.KeyBindingAction.SWITCH_GROUP)
-            this._select(this._currentApp, backwards ? this._previousWindow() : this._nextWindow());
+            this._select(this._currentApp, backwards ? this._previousWindowInWorkspace() : this._nextWindowInWorkspace());
         else if (keysym == Clutter.Escape)
             this.destroy();
         else if (this._thumbnailsFocused) {
@@ -240,7 +282,7 @@ AltTabPopup.prototype = {
                 this._select(this._currentApp, null, true);
         } else {
             if (action == Meta.KeyBindingAction.SWITCH_WINDOWS)
-                this._select(backwards ? this._previousApp() : this._nextApp());
+                this._select(backwards ? this._previousAppInWorkspace() : this._nextAppInWorkspace());
             else if (keysym == Clutter.Left)
                 this._select(this._previousApp());
             else if (keysym == Clutter.Right)
@@ -484,6 +526,15 @@ AltTabPopup.prototype = {
                            transition: 'easeOutQuad',
                            onComplete: Lang.bind(this, function () { this.thumbnailsVisible = true; })
                          });
+    },
+
+    _hasWindowsOnWorkspace: function(appIcon, workspace) {
+        let windows = appIcon.cachedWindows;
+        for (let i = 0; i < windows.length; i++) {
+            if (windows[i].get_workspace() == workspace)
+                return true;
+        }
+        return false;
     }
 };
 
