[gnome-shell] viewSelector: Bind <Ctrl>+<Return> for open new window



commit 203dedfb3ab216ee4bcd5d3a7e158cc9506410ca
Author: Maxim Ermilov <zaspire rambler ru>
Date:   Sat Jul 16 23:27:05 2011 +0400

    viewSelector: Bind <Ctrl>+<Return> for open new window
    
    https://bugzilla.gnome.org/show_bug.cgi?id=613082

 js/ui/appDisplay.js   |   10 +++++++++-
 js/ui/viewSelector.js |   18 ++++++++++++------
 2 files changed, 21 insertions(+), 7 deletions(-)
---
diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js
index 5f38de3..992a954 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -327,8 +327,16 @@ BaseAppSearchProvider.prototype = {
         params = Params.parse(params, { workspace: null,
                                         timestamp: null });
 
+        let workspace = params.workspace ? params.workspace.index() : -1;
+        let event = Clutter.get_current_event();
+        let modifiers = event ? Shell.get_event_state(event) : 0;
+        let openNewWindow = modifiers & Clutter.ModifierType.CONTROL_MASK;
+
         let app = this._appSys.get_app(id);
-        app.activate(params.workspace ? params.workspace.index() : -1);
+        if (openNewWindow)
+            app.open_new_window(workspace);
+        else
+            app.activate(workspace);
     },
 
     dragActivateResult: function(id, params) {
diff --git a/js/ui/viewSelector.js b/js/ui/viewSelector.js
index 29110fd..53b349c 100644
--- a/js/ui/viewSelector.js
+++ b/js/ui/viewSelector.js
@@ -141,13 +141,19 @@ SearchTab.prototype = {
                                      'edit-find');
 
         this._text.connect('text-changed', Lang.bind(this, this._onTextChanged));
-        this._text.connect('activate', Lang.bind(this, function (se) {
-            if (this._searchTimeoutId > 0) {
-                Mainloop.source_remove(this._searchTimeoutId);
-                this._doSearch();
+        this._text.connect('key-press-event', Lang.bind(this, function (o, e) {
+            // We can't connect to 'activate' here because search providers
+            // might want to do something with the modifiers in activateSelected.
+            let symbol = e.get_key_symbol();
+            if (symbol == Clutter.Return || symbol == Clutter.KP_Enter) {
+                if (this._searchTimeoutId > 0) {
+                    Mainloop.source_remove(this._searchTimeoutId);
+                    this._doSearch();
+                }
+                this._searchResults.activateSelected();
+                return true;
             }
-            this._searchResults.activateSelected();
-            return true;
+            return false;
         }));
 
         this._entry.connect('notify::mapped', Lang.bind(this, this._onMapped));



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]