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
This commit is contained in:
Debarshi Ray 2014-01-09 15:36:41 +01:00
parent 5c5b9cfd96
commit 68faba6bde

View File

@ -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();