[gnome-shell/wip/gestures: 8/8] windowManager: switch workspaces on 4-finger drag



commit eca4b1b97aa7abeee054c40a2ef0a4d6adbb0b95
Author: Carlos Garnacho <carlosg gnome org>
Date:   Wed Jun 25 18:13:26 2014 +0200

    windowManager: switch workspaces on 4-finger drag
    
    The workspace to switch is obtained from the direction received
    by the WorkspaceSwitchAction gesture.

 js/ui/windowManager.js |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/js/ui/windowManager.js b/js/ui/windowManager.js
index bca0466..50883f7 100644
--- a/js/ui/windowManager.js
+++ b/js/ui/windowManager.js
@@ -11,6 +11,7 @@ const St = imports.gi.St;
 const Shell = imports.gi.Shell;
 
 const AltTab = imports.ui.altTab;
+const WorkspaceSwitchAction = imports.ui.workspaceSwitchAction;
 const WorkspaceSwitcherPopup = imports.ui.workspaceSwitcherPopup;
 const Main = imports.ui.main;
 const ModalDialog = imports.ui.modalDialog;
@@ -683,6 +684,14 @@ const WindowManager = new Lang.Class({
 
         global.screen.override_workspace_layout(Meta.ScreenCorner.TOPLEFT,
                                                 false, -1, 1);
+
+        let gesture = new WorkspaceSwitchAction.WorkspaceSwitchAction();
+        gesture.connect('gesture-end', Lang.bind(this, function() {
+            let direction = gesture.getDirection();
+            let newWs = global.screen.get_active_workspace().get_neighbor(direction);
+            this.actionMoveWorkspace(newWs);
+        }));
+        global.stage.add_action(gesture);
     },
 
     keepWorkspaceAlive: function(workspace, duration) {


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