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
This commit is contained in:
parent
339a78718d
commit
40214b72bf
@ -2451,6 +2451,19 @@ process_keyboard_resize_grab (MetaDisplay *display,
|
|||||||
return handled;
|
return handled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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
|
static void
|
||||||
handle_switch_to_workspace (MetaDisplay *display,
|
handle_switch_to_workspace (MetaDisplay *display,
|
||||||
MetaScreen *screen,
|
MetaScreen *screen,
|
||||||
@ -3023,6 +3036,26 @@ handle_toggle_on_all_workspaces (MetaDisplay *display,
|
|||||||
meta_window_stick (window);
|
meta_window_stick (window);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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
|
static void
|
||||||
handle_move_to_workspace (MetaDisplay *display,
|
handle_move_to_workspace (MetaDisplay *display,
|
||||||
MetaScreen *screen,
|
MetaScreen *screen,
|
||||||
@ -3340,6 +3373,14 @@ init_builtin_key_bindings (MetaDisplay *display)
|
|||||||
META_KEYBINDING_ACTION_WORKSPACE_DOWN,
|
META_KEYBINDING_ACTION_WORKSPACE_DOWN,
|
||||||
NULL, 0);
|
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
|
/* The ones which have inverses. These can't be bound to any keystroke
|
||||||
* containing Shift because Shift will invert their "backward" state.
|
* containing Shift because Shift will invert their "backward" state.
|
||||||
@ -3721,6 +3762,13 @@ init_builtin_key_bindings (MetaDisplay *display)
|
|||||||
META_KEYBINDING_ACTION_MOVE_TO_WORKSPACE_12,
|
META_KEYBINDING_ACTION_MOVE_TO_WORKSPACE_12,
|
||||||
handle_move_to_workspace, 11);
|
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,
|
add_builtin_keybinding (display,
|
||||||
"move-to-workspace-left",
|
"move-to-workspace-left",
|
||||||
common_keybindings,
|
common_keybindings,
|
||||||
|
@ -185,6 +185,7 @@ void meta_prefs_set_ignore_request_hide_titlebar (gboolean whether);
|
|||||||
* @META_KEYBINDING_ACTION_WORKSPACE_RIGHT: FILLME
|
* @META_KEYBINDING_ACTION_WORKSPACE_RIGHT: FILLME
|
||||||
* @META_KEYBINDING_ACTION_WORKSPACE_UP: FILLME
|
* @META_KEYBINDING_ACTION_WORKSPACE_UP: FILLME
|
||||||
* @META_KEYBINDING_ACTION_WORKSPACE_DOWN: FILLME
|
* @META_KEYBINDING_ACTION_WORKSPACE_DOWN: FILLME
|
||||||
|
* @META_KEYBINDING_ACTION_WORKSPACE_LAST: FILLME
|
||||||
* @META_KEYBINDING_ACTION_SWITCH_APPLICATIONS: FILLME
|
* @META_KEYBINDING_ACTION_SWITCH_APPLICATIONS: FILLME
|
||||||
* @META_KEYBINDING_ACTION_SWITCH_APPLICATIONS_BACKWARD: FILLME
|
* @META_KEYBINDING_ACTION_SWITCH_APPLICATIONS_BACKWARD: FILLME
|
||||||
* @META_KEYBINDING_ACTION_SWITCH_GROUP: 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_RIGHT: FILLME
|
||||||
* @META_KEYBINDING_ACTION_MOVE_TO_WORKSPACE_UP: FILLME
|
* @META_KEYBINDING_ACTION_MOVE_TO_WORKSPACE_UP: FILLME
|
||||||
* @META_KEYBINDING_ACTION_MOVE_TO_WORKSPACE_DOWN: 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_LEFT: FILLME
|
||||||
* @META_KEYBINDING_ACTION_MOVE_TO_MONITOR_RIGHT: FILLME
|
* @META_KEYBINDING_ACTION_MOVE_TO_MONITOR_RIGHT: FILLME
|
||||||
* @META_KEYBINDING_ACTION_MOVE_TO_MONITOR_UP: 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_RIGHT,
|
||||||
META_KEYBINDING_ACTION_WORKSPACE_UP,
|
META_KEYBINDING_ACTION_WORKSPACE_UP,
|
||||||
META_KEYBINDING_ACTION_WORKSPACE_DOWN,
|
META_KEYBINDING_ACTION_WORKSPACE_DOWN,
|
||||||
|
META_KEYBINDING_ACTION_WORKSPACE_LAST,
|
||||||
META_KEYBINDING_ACTION_SWITCH_APPLICATIONS,
|
META_KEYBINDING_ACTION_SWITCH_APPLICATIONS,
|
||||||
META_KEYBINDING_ACTION_SWITCH_APPLICATIONS_BACKWARD,
|
META_KEYBINDING_ACTION_SWITCH_APPLICATIONS_BACKWARD,
|
||||||
META_KEYBINDING_ACTION_SWITCH_GROUP,
|
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_RIGHT,
|
||||||
META_KEYBINDING_ACTION_MOVE_TO_WORKSPACE_UP,
|
META_KEYBINDING_ACTION_MOVE_TO_WORKSPACE_UP,
|
||||||
META_KEYBINDING_ACTION_MOVE_TO_WORKSPACE_DOWN,
|
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_LEFT,
|
||||||
META_KEYBINDING_ACTION_MOVE_TO_MONITOR_RIGHT,
|
META_KEYBINDING_ACTION_MOVE_TO_MONITOR_RIGHT,
|
||||||
META_KEYBINDING_ACTION_MOVE_TO_MONITOR_UP,
|
META_KEYBINDING_ACTION_MOVE_TO_MONITOR_UP,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user