From 4a6b89d44ce9030a0503de87040474b30011c1c6 Mon Sep 17 00:00:00 2001 From: Elad Alfassa Date: Sat, 18 May 2013 20:55:05 +0300 Subject: [PATCH] windowManager: add switch-to-workspace-last keybinding When using dynamic workspace, the number of the last workspace may vary, and it would be nice to have a keybinding to jump directly to it. https://bugzilla.gnome.org/show_bug.cgi?id=659288 --- js/ui/windowManager.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/js/ui/windowManager.js b/js/ui/windowManager.js index bc43388b5..ae6a20717 100644 --- a/js/ui/windowManager.js +++ b/js/ui/windowManager.js @@ -507,6 +507,10 @@ const WindowManager = new Lang.Class({ Shell.KeyBindingMode.NORMAL | Shell.KeyBindingMode.OVERVIEW, Lang.bind(this, this._showWorkspaceSwitcher)); + this.setCustomKeybindingHandler('switch-to-workspace-last', + Shell.KeyBindingMode.NORMAL | + Shell.KeyBindingMode.OVERVIEW, + Lang.bind(this, this._showWorkspaceSwitcher)); this.setCustomKeybindingHandler('move-to-workspace-left', Shell.KeyBindingMode.NORMAL | Shell.KeyBindingMode.OVERVIEW, @@ -607,6 +611,9 @@ const WindowManager = new Lang.Class({ this.setCustomKeybindingHandler('move-to-workspace-12', Shell.KeyBindingMode.NORMAL, Lang.bind(this, this._showWorkspaceSwitcher)); + this.setCustomKeybindingHandler('move-to-workspace-last', + Shell.KeyBindingMode.NORMAL, + Lang.bind(this, this._showWorkspaceSwitcher)); this.setCustomKeybindingHandler('switch-applications', Shell.KeyBindingMode.NORMAL, Lang.bind(this, this._startAppSwitcher)); @@ -1208,7 +1215,10 @@ const WindowManager = new Lang.Class({ let newWs; let direction; - if (isNaN(target)) { + if (target == 'last') { + direction = Meta.MotionDirection.DOWN; + newWs = screen.get_workspace_by_index(screen.n_workspaces - 1); + } else if (isNaN(target)) { direction = Meta.MotionDirection[target.toUpperCase()]; newWs = screen.get_active_workspace().get_neighbor(direction); } else if (target > 0) {