[gnome-shell] appDisplay: Special case terminal launching



commit 68faba6bde08a88989418df7861563eb458567bd
Author: Debarshi Ray <debarshir gnome org>
Date:   Thu Jan 9 15:36:41 2014 +0100

    appDisplay: Special case terminal launching
    
    One of the most frequent complaints about our launching behaviour is
    how we handle terminals. Among all MDI applications, the terminal is
    the one that is most likely to have lots of semi-independent windows
    opened at the same time, and spawning new windows is much more common.
    More so, if it does not support tabs.
    
    Therefore, we special case terminal launchers to always create a new
    window. It is an application that most non-technical users will not
    use, so chances of them being confused by any special behaviour is
    expected to be low.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=695010

 js/ui/appDisplay.js |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js
index cdd1e1a..1a04fda 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -47,6 +47,10 @@ const INDICATORS_ANIMATION_MAX_TIME = 0.75;
 const PAGE_SWITCH_TRESHOLD = 0.2;
 const PAGE_SWITCH_TIME = 0.3;
 
+function _isTerminal(app) {
+    return app.get_app_info().get_categories().indexOf('TerminalEmulator') > -1;
+};
+
 // Recursively load a GMenuTreeDirectory; we could put this in ShellAppSystem too
 function _loadCategory(dir, view) {
     let iter = dir.iter();
@@ -913,7 +917,7 @@ const AppSearchProvider = new Lang.Class({
         let app = this._appSys.lookup_app(result);
         let event = Clutter.get_current_event();
         let modifiers = event ? event.get_state() : 0;
-        let openNewWindow = modifiers & Clutter.ModifierType.CONTROL_MASK;
+        let openNewWindow = (modifiers & Clutter.ModifierType.CONTROL_MASK) || _isTerminal(app);
 
         if (openNewWindow)
             app.open_new_window(-1);
@@ -1448,8 +1452,9 @@ const AppIcon = new Lang.Class({
     _onActivate: function (event) {
         let modifiers = event.get_state();
 
-        if (modifiers & Clutter.ModifierType.CONTROL_MASK
-            && this.app.state == Shell.AppState.RUNNING) {
+        if ((modifiers & Clutter.ModifierType.CONTROL_MASK
+             && this.app.state == Shell.AppState.RUNNING)
+            || _isTerminal(this.app)) {
             this.app.open_new_window(-1);
         } else {
             this.app.activate();


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