summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorNo_name <[email protected]>2015-09-25 11:33:36 +0200
committerNo_name <[email protected]>2015-09-25 11:33:36 +0200
commit2380955609c8bb383226951660d6fd1944481e9b (patch)
tree15a6f1e8249e92872bcf5fe2c41a8c0d08f609bc /src/core
parent5a5236d833230939333fb9a66422e88e40f0f54d (diff)
parentda35f0b35b46682d3566cb0ffc7ec2136317a1c9 (diff)
downloadmarco-2380955609c8bb383226951660d6fd1944481e9b.tar.bz2
marco-2380955609c8bb383226951660d6fd1944481e9b.tar.xz
Merge pull request #168 from robertek/swith_to_workspace_prev
Possible keybinding to switch to previous workspace.
Diffstat (limited to 'src/core')
-rw-r--r--src/core/keybindings.c8
-rw-r--r--src/core/screen-private.h3
-rw-r--r--src/core/workspace.c9
-rw-r--r--src/core/workspace.h3
4 files changed, 22 insertions, 1 deletions
diff --git a/src/core/keybindings.c b/src/core/keybindings.c
index 9e602a91..068199b8 100644
--- a/src/core/keybindings.c
+++ b/src/core/keybindings.c
@@ -2288,6 +2288,14 @@ handle_switch_to_workspace (MetaDisplay *display,
{
gint which = binding->handler->data;
MetaWorkspace *workspace;
+
+ if (which == META_MOTION_PREV)
+ {
+ workspace = screen->prev_workspace;
+ if (workspace)
+ meta_workspace_activate (workspace, event->xkey.time);
+ return;
+ }
if (which < 0)
{
diff --git a/src/core/screen-private.h b/src/core/screen-private.h
index ee014ff2..c1552ab0 100644
--- a/src/core/screen-private.h
+++ b/src/core/screen-private.h
@@ -85,6 +85,9 @@ struct _MetaScreen
MetaWorkspace *active_workspace;
+ /* Previous active workspace */
+ MetaWorkspace *prev_workspace;
+
/* This window holds the focus when we don't want to focus
* any actual clients
*/
diff --git a/src/core/workspace.c b/src/core/workspace.c
index 928f3de6..e2a397a0 100644
--- a/src/core/workspace.c
+++ b/src/core/workspace.c
@@ -389,6 +389,9 @@ meta_workspace_activate_with_focus (MetaWorkspace *workspace,
/* Note that old can be NULL; e.g. when starting up */
old = workspace->screen->active_workspace;
+ /* Save old workspace, to be able to switch back. */
+ workspace->screen->prev_workspace = old;
+
workspace->screen->active_workspace = workspace;
set_active_space_hint (workspace->screen);
@@ -807,6 +810,8 @@ meta_motion_direction_to_string (MetaMotionDirection direction)
return "Left";
case META_MOTION_RIGHT:
return "Right";
+ case META_MOTION_PREV:
+ return "Previous";
}
return "Unknown";
@@ -847,6 +852,8 @@ meta_workspace_get_neighbor (MetaWorkspace *workspace,
case META_MOTION_DOWN:
layout.current_row += 1;
break;
+ case META_MOTION_PREV:
+ break;
}
/* LEFT */
@@ -923,6 +930,8 @@ meta_workspace_get_neighbor (MetaWorkspace *workspace,
if (wrap == META_WRAP_TOROIDAL)
layout.current_col = layout.current_col < layout.cols - 1 ? layout.current_col + 1 : 0;
break;
+ case META_MOTION_PREV:
+ break;
}
i = layout.grid[layout.current_row * layout.cols + layout.current_col];
diff --git a/src/core/workspace.h b/src/core/workspace.h
index 40942e1a..4b52f96e 100644
--- a/src/core/workspace.h
+++ b/src/core/workspace.h
@@ -43,7 +43,8 @@ typedef enum
META_MOTION_UP = -1,
META_MOTION_DOWN = -2,
META_MOTION_LEFT = -3,
- META_MOTION_RIGHT = -4
+ META_MOTION_RIGHT = -4,
+ META_MOTION_PREV = -5
} MetaMotionDirection;
struct _MetaWorkspace