diff options
| author | Robert David <[email protected]> | 2015-01-22 22:40:44 +0100 | 
|---|---|---|
| committer | Robert David <[email protected]> | 2015-01-23 15:20:22 +0100 | 
| commit | da35f0b35b46682d3566cb0ffc7ec2136317a1c9 (patch) | |
| tree | 0d86a101945a3ad883ee21bf98c22f5847f03089 | |
| parent | 05ac791462644b0d9dd909e995be996fdfa139cc (diff) | |
| download | marco-da35f0b35b46682d3566cb0ffc7ec2136317a1c9.tar.bz2 marco-da35f0b35b46682d3566cb0ffc7ec2136317a1c9.tar.xz | |
Possible keybinding to switch to previous workspace.
Disabled at default.
| -rw-r--r-- | src/50-marco-global-key.xml.in | 3 | ||||
| -rw-r--r-- | src/core/keybindings.c | 8 | ||||
| -rw-r--r-- | src/core/screen-private.h | 3 | ||||
| -rw-r--r-- | src/core/workspace.c | 9 | ||||
| -rw-r--r-- | src/core/workspace.h | 3 | ||||
| -rw-r--r-- | src/include/all-keybindings.h | 3 | ||||
| -rw-r--r-- | src/org.mate.marco.gschema.xml | 5 | 
7 files changed, 33 insertions, 1 deletions
| diff --git a/src/50-marco-global-key.xml.in b/src/50-marco-global-key.xml.in index 81a8db85..84276a86 100644 --- a/src/50-marco-global-key.xml.in +++ b/src/50-marco-global-key.xml.in @@ -127,5 +127,8 @@  	schema="org.mate.Marco.general"  	comparison="gt" /> +	<KeyListEntry name="switch-to-workspace-prev" +	_description="Switch to previously selected workspace" /> +  </KeyListEntries> diff --git a/src/core/keybindings.c b/src/core/keybindings.c index 041d96fc..821d432a 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 b85ab53c..d61529d2 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); @@ -798,6 +801,8 @@ meta_motion_direction_to_string (MetaMotionDirection direction)        return "Left";      case META_MOTION_RIGHT:        return "Right"; +    case META_MOTION_PREV: +      return "Previous";      }    return "Unknown"; @@ -838,6 +843,8 @@ meta_workspace_get_neighbor (MetaWorkspace      *workspace,      case META_MOTION_DOWN:        layout.current_row += 1;        break; +    case META_MOTION_PREV: +      break;      }    /* LEFT */ @@ -914,6 +921,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 diff --git a/src/include/all-keybindings.h b/src/include/all-keybindings.h index 5b030280..50532c4b 100644 --- a/src/include/all-keybindings.h +++ b/src/include/all-keybindings.h @@ -272,5 +272,8 @@ keybind (move-to-side-w, handle_move_to_side_w, 0,  keybind (move-to-center, handle_move_to_center, 0,          BINDING_PER_WINDOW) +keybind (switch-to-workspace-prev, handle_switch_to_workspace, +         META_MOTION_PREV, 0) +  /* eof all-keybindings.h */ 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 "<Control>a" or "<Shift><Alt>F1". The parser is fairly liberal and allows lower or upper case, and also abbreviations such as "<Ctl>" and "<Ctrl>". 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 "<Control>a" or "<Shift><Alt>F1". The parser is fairly liberal and allows lower or upper case, and also abbreviations such as "<Ctl>" and "<Ctrl>". 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> | 
