[mutter] keybindings: Add keybindings to switch to last workspace
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] keybindings: Add keybindings to switch to last workspace
- Date: Wed, 16 Apr 2014 19:44:30 +0000 (UTC)
commit 40214b72bfbd7e73402bdf8de1256218ca29cfc7
Author: Elad Alfassa <elad fedoraproject org>
Date: Fri May 17 15:08:57 2013 +0300
keybindings: Add keybindings to switch to last workspace
When using dynamic workspaces, the last workspaces can vary, so it makes sense
to have a keybinding to go directly to it.
https://bugzilla.gnome.org/show_bug.cgi?id=659288
src/core/keybindings.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
src/meta/prefs.h | 4 ++++
2 files changed, 52 insertions(+), 0 deletions(-)
---
diff --git a/src/core/keybindings.c b/src/core/keybindings.c
index 8aa247a..cc9b09b 100644
--- a/src/core/keybindings.c
+++ b/src/core/keybindings.c
@@ -2452,6 +2452,19 @@ process_keyboard_resize_grab (MetaDisplay *display,
}
static void
+handle_switch_to_last_workspace (MetaDisplay *display,
+ MetaScreen *screen,
+ MetaWindow *event_window,
+ ClutterKeyEvent *event,
+ MetaKeyBinding *binding,
+ gpointer dummy)
+{
+ gint target = meta_screen_get_n_workspaces(screen) - 1;
+ MetaWorkspace *workspace = meta_screen_get_workspace_by_index (screen, target);
+ meta_workspace_activate (workspace, event->time);
+}
+
+static void
handle_switch_to_workspace (MetaDisplay *display,
MetaScreen *screen,
MetaWindow *event_window,
@@ -3024,6 +3037,26 @@ handle_toggle_on_all_workspaces (MetaDisplay *display,
}
static void
+handle_move_to_workspace_last (MetaDisplay *display,
+ MetaScreen *screen,
+ MetaWindow *window,
+ ClutterKeyEvent *event,
+ MetaKeyBinding *binding,
+ gpointer dummy)
+{
+ gint which;
+ MetaWorkspace *workspace;
+
+ if (window->always_sticky)
+ return;
+
+ which = meta_screen_get_n_workspaces (screen) - 1;
+ workspace = meta_screen_get_workspace_by_index (screen, which);
+ meta_window_change_workspace (window, workspace);
+}
+
+
+static void
handle_move_to_workspace (MetaDisplay *display,
MetaScreen *screen,
MetaWindow *window,
@@ -3340,6 +3373,14 @@ init_builtin_key_bindings (MetaDisplay *display)
META_KEYBINDING_ACTION_WORKSPACE_DOWN,
NULL, 0);
+ add_builtin_keybinding (display,
+ "switch-to-workspace-last",
+ common_keybindings,
+ META_KEY_BINDING_NONE,
+ META_KEYBINDING_ACTION_WORKSPACE_LAST,
+ handle_switch_to_last_workspace, 0);
+
+
/* The ones which have inverses. These can't be bound to any keystroke
* containing Shift because Shift will invert their "backward" state.
@@ -3722,6 +3763,13 @@ init_builtin_key_bindings (MetaDisplay *display)
handle_move_to_workspace, 11);
add_builtin_keybinding (display,
+ "move-to-workspace-last",
+ common_keybindings,
+ META_KEY_BINDING_PER_WINDOW,
+ META_KEYBINDING_ACTION_MOVE_TO_WORKSPACE_LAST,
+ handle_move_to_workspace_last, 0);
+
+ add_builtin_keybinding (display,
"move-to-workspace-left",
common_keybindings,
META_KEY_BINDING_PER_WINDOW,
diff --git a/src/meta/prefs.h b/src/meta/prefs.h
index 677110a..de2ab17 100644
--- a/src/meta/prefs.h
+++ b/src/meta/prefs.h
@@ -185,6 +185,7 @@ void meta_prefs_set_ignore_request_hide_titlebar (gboolean whether);
* @META_KEYBINDING_ACTION_WORKSPACE_RIGHT: FILLME
* @META_KEYBINDING_ACTION_WORKSPACE_UP: FILLME
* @META_KEYBINDING_ACTION_WORKSPACE_DOWN: FILLME
+ * @META_KEYBINDING_ACTION_WORKSPACE_LAST: FILLME
* @META_KEYBINDING_ACTION_SWITCH_APPLICATIONS: FILLME
* @META_KEYBINDING_ACTION_SWITCH_APPLICATIONS_BACKWARD: FILLME
* @META_KEYBINDING_ACTION_SWITCH_GROUP: FILLME
@@ -234,6 +235,7 @@ void meta_prefs_set_ignore_request_hide_titlebar (gboolean whether);
* @META_KEYBINDING_ACTION_MOVE_TO_WORKSPACE_RIGHT: FILLME
* @META_KEYBINDING_ACTION_MOVE_TO_WORKSPACE_UP: FILLME
* @META_KEYBINDING_ACTION_MOVE_TO_WORKSPACE_DOWN: FILLME
+ * @META_KEYBINDING_ACTION_MOVE_TO_WORKSPACE_LAST: FILLME
* @META_KEYBINDING_ACTION_MOVE_TO_MONITOR_LEFT: FILLME
* @META_KEYBINDING_ACTION_MOVE_TO_MONITOR_RIGHT: FILLME
* @META_KEYBINDING_ACTION_MOVE_TO_MONITOR_UP: FILLME
@@ -280,6 +282,7 @@ typedef enum _MetaKeyBindingAction
META_KEYBINDING_ACTION_WORKSPACE_RIGHT,
META_KEYBINDING_ACTION_WORKSPACE_UP,
META_KEYBINDING_ACTION_WORKSPACE_DOWN,
+ META_KEYBINDING_ACTION_WORKSPACE_LAST,
META_KEYBINDING_ACTION_SWITCH_APPLICATIONS,
META_KEYBINDING_ACTION_SWITCH_APPLICATIONS_BACKWARD,
META_KEYBINDING_ACTION_SWITCH_GROUP,
@@ -329,6 +332,7 @@ typedef enum _MetaKeyBindingAction
META_KEYBINDING_ACTION_MOVE_TO_WORKSPACE_RIGHT,
META_KEYBINDING_ACTION_MOVE_TO_WORKSPACE_UP,
META_KEYBINDING_ACTION_MOVE_TO_WORKSPACE_DOWN,
+ META_KEYBINDING_ACTION_MOVE_TO_WORKSPACE_LAST,
META_KEYBINDING_ACTION_MOVE_TO_MONITOR_LEFT,
META_KEYBINDING_ACTION_MOVE_TO_MONITOR_RIGHT,
META_KEYBINDING_ACTION_MOVE_TO_MONITOR_UP,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]