summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert David <[email protected]>2014-03-10 11:58:07 +0100
committerinfirit <[email protected]>2014-06-24 23:09:21 +0200
commit69b7a0ad9277f21ad761c84ac1bae5455a2f879e (patch)
tree9a244ed257c08437edcf6d637420f98ac6dd3639
parent897defba089400c910a520ca1302ca5573d3f1d7 (diff)
downloadmarco-69b7a0ad9277f21ad761c84ac1bae5455a2f879e.tar.bz2
marco-69b7a0ad9277f21ad761c84ac1bae5455a2f879e.tar.xz
Possible keybinding to switch to previous workspace.
Disabled at default.
-rw-r--r--src/50-marco-global-key.xml.in7
-rw-r--r--src/core/keybindings.c8
-rw-r--r--src/core/screen-private.h3
-rw-r--r--src/core/workspace.c3
-rw-r--r--src/core/workspace.h3
-rw-r--r--src/include/all-keybindings.h3
-rw-r--r--src/marco.convert1
-rw-r--r--src/org.mate.marco.gschema.xml5
8 files changed, 32 insertions, 1 deletions
diff --git a/src/50-marco-global-key.xml.in b/src/50-marco-global-key.xml.in
index 9a61c376..1a1423bd 100644
--- a/src/50-marco-global-key.xml.in
+++ b/src/50-marco-global-key.xml.in
@@ -127,5 +127,12 @@
schema="org.mate.Marco.general"
comparison="gt" />
+ <KeyListEntry name="switch-to-workspace-prev"
+ _description="Switch to previously selected workspace"
+ value="1"
+ key="num-workspaces"
+ schema="org.mate.Marco.general"
+ comparison="gt" />
+
</KeyListEntries>
diff --git a/src/core/keybindings.c b/src/core/keybindings.c
index 8dda13cd..29df5a66 100644
--- a/src/core/keybindings.c
+++ b/src/core/keybindings.c
@@ -2242,6 +2242,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 8eb02d00..0d1d4bc5 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 05ca7c70..a0a8ad1e 100644
--- a/src/core/workspace.c
+++ b/src/core/workspace.c
@@ -385,6 +385,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);
diff --git a/src/core/workspace.h b/src/core/workspace.h
index c6983bf0..e2c5a244 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
diff --git a/src/include/all-keybindings.h b/src/include/all-keybindings.h
index 10488a12..445d39f7 100644
--- a/src/include/all-keybindings.h
+++ b/src/include/all-keybindings.h
@@ -111,6 +111,9 @@ keybind (switch-to-workspace-up, handle_switch_to_workspace,
keybind (switch-to-workspace-down, handle_switch_to_workspace,
META_MOTION_DOWN, 0)
+keybind (switch-to-workspace-prev, handle_switch_to_workspace,
+ META_MOTION_PREV, 0)
+
/***********************************/
/* The ones which have inverses. These can't be bound to any keystroke
diff --git a/src/marco.convert b/src/marco.convert
index eb1f623b..dec988d0 100644
--- a/src/marco.convert
+++ b/src/marco.convert
@@ -71,6 +71,7 @@ switch-to-workspace-left = /apps/marco/global_keybindings/switch_to_workspace_le
switch-to-workspace-right = /apps/marco/global_keybindings/switch_to_workspace_right
switch-to-workspace-up = /apps/marco/global_keybindings/switch_to_workspace_up
switch-to-workspace-down = /apps/marco/global_keybindings/switch_to_workspace_down
+switch-to-workspace-prev = /apps/marco/global_keybindings/switch_to_workspace_prev
switch-group = /apps/marco/global_keybindings/switch_group
switch-group-backward = /apps/marco/global_keybindings/switch_group_backward
switch-windows = /apps/marco/global_keybindings/switch_windows
diff --git a/src/org.mate.marco.gschema.xml b/src/org.mate.marco.gschema.xml
index a0725382..5a1bef84 100644
--- a/src/org.mate.marco.gschema.xml
+++ b/src/org.mate.marco.gschema.xml
@@ -497,6 +497,11 @@
<summary>Switch to workspace below the current workspace</summary>
<description>The format looks like "&lt;Control&gt;a" or "&lt;Shift&gt;&lt;Alt&gt;F1". The parser is fairly liberal and allows lower or upper case, and also abbreviations such as "&lt;Ctl&gt;" and "&lt;Ctrl&gt;". If you set the option to the special string "disabled", then there will be no keybinding for this action.</description>
</key>
+ <key name="switch-to-workspace-prev" type="s">
+ <default>'disabled'</default>
+ <summary>Switch to previously selected workspace</summary>
+ <description>The format looks like "&lt;Control&gt;a" or "&lt;Shift&gt;&lt;Alt&gt;F1". The parser is fairly liberal and allows lower or upper case, and also abbreviations such as "&lt;Ctl&gt;" and "&lt;Ctrl&gt;". If you set the option to the special string "disabled", then there will be no keybinding for this action.</description>
+ </key>
<key name="switch-group" type="s">
<default>'disabled'</default>
<summary>Move between windows of an application, using a popup window</summary>