[gnome-shell] workspacesView: Allow switching workspaces in overview with pageUp/Down
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] workspacesView: Allow switching workspaces in overview with pageUp/Down
- Date: Thu, 26 Mar 2015 21:00:22 +0000 (UTC)
commit e2a17fa8b4a386118820cd0fcecd4f28ebbc4a09
Author: Devyani Kota <divs passion 18 gmail com>
Date: Thu Mar 26 20:47:35 2015 +0530
workspacesView: Allow switching workspaces in overview with pageUp/Down
To switch workspace by keyboard in the overview, the user currently
has to use the normal keybinding. However as the vertical alignment
of workspaces makes them very similar to pages in the app picker, it
makes sense to also support the standard pageUp/pageDown keys.
https://bugzilla.gnome.org/show_bug.cgi?id=742581
js/ui/workspacesView.js | 28 +++++++++++++++++++++++++++-
1 files changed, 27 insertions(+), 1 deletions(-)
---
diff --git a/js/ui/workspacesView.js b/js/ui/workspacesView.js
index 4c8f901..46d7dad 100644
--- a/js/ui/workspacesView.js
+++ b/js/ui/workspacesView.js
@@ -464,6 +464,7 @@ const WorkspacesDisplay = new Lang.Class({
this._notifyOpacityId = 0;
this._scrollEventId = 0;
+ this._keyPressEventId = 0;
this._fullGeometry = null;
},
@@ -495,6 +496,9 @@ const WorkspacesDisplay = new Lang.Class({
Lang.bind(this, this._onRestacked));
if (this._scrollEventId == 0)
this._scrollEventId = Main.overview.connect('scroll-event', Lang.bind(this,
this._onScrollEvent));
+
+ if (this._keyPressEventId == 0)
+ this._keyPressEventId = global.stage.connect('key-press-event', Lang.bind(this,
this._onKeyPressEvent));
},
animateFromOverview: function(fadeOnPrimary) {
@@ -517,7 +521,10 @@ const WorkspacesDisplay = new Lang.Class({
Main.overview.disconnect(this._scrollEventId);
this._scrollEventId = 0;
}
-
+ if (this._keyPressEventId > 0) {
+ global.stage.disconnect(this._keyPressEventId);
+ this._keyPressEventId = 0;
+ }
for (let i = 0; i < this._workspacesViews.length; i++)
this._workspacesViews[i].destroy();
this._workspacesViews = [];
@@ -670,6 +677,25 @@ const WorkspacesDisplay = new Lang.Class({
}
Main.wm.actionMoveWorkspace(ws);
return Clutter.EVENT_STOP;
+ },
+
+ _onKeyPressEvent: function(actor, event) {
+ if (!this.actor.mapped)
+ return Clutter.EVENT_PROPAGATE;
+ let activeWs = global.screen.get_active_workspace();
+ let ws;
+ switch (event.get_key_symbol()) {
+ case Clutter.KEY_Page_Up:
+ ws = activeWs.get_neighbor(Meta.MotionDirection.UP);
+ break;
+ case Clutter.KEY_Page_Down:
+ ws = activeWs.get_neighbor(Meta.MotionDirection.DOWN);
+ break;
+ default:
+ return Clutter.EVENT_PROPAGATE;
+ }
+ Main.wm.actionMoveWorkspace(ws);
+ return Clutter.EVENT_STOP;
}
});
Signals.addSignalMethods(WorkspacesDisplay.prototype);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]