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
This commit is contained in:
Elad Alfassa 2013-05-18 20:55:05 +03:00 committed by Florian Müllner
parent 7fa1834ab6
commit 4a6b89d44c

View File

@ -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) {