AppWell: If an application is running, activate an existing window
Instead of relaunching, pick the first window and activate
This commit is contained in:
@ -467,8 +467,7 @@ WellDisplayItem.prototype = {
|
||||
}));
|
||||
this.actor._delegate = this;
|
||||
this.actor.connect('button-release-event', Lang.bind(this, function (b, e) {
|
||||
this.launch();
|
||||
this.emit('activated');
|
||||
this._handleActivate();
|
||||
}));
|
||||
|
||||
let draggable = DND.makeDraggable(this.actor);
|
||||
@ -480,7 +479,7 @@ WellDisplayItem.prototype = {
|
||||
|
||||
this.actor.append(iconBox, Big.BoxPackFlags.NONE);
|
||||
|
||||
let count = Shell.AppMonitor.get_default().get_window_count(appInfo.appId);
|
||||
this._windows = Shell.AppMonitor.get_default().get_windows_for_app(appInfo.appId)
|
||||
|
||||
let nameBox = new Big.Box({ orientation: Big.BoxOrientation.VERTICAL,
|
||||
x_align: Big.BoxAlignment.CENTER });
|
||||
@ -492,7 +491,7 @@ WellDisplayItem.prototype = {
|
||||
line_wrap_mode: Pango.WrapMode.WORD_CHAR,
|
||||
text: appInfo.name });
|
||||
nameBox.append(this._name, Big.BoxPackFlags.EXPAND);
|
||||
if (count > 0) {
|
||||
if (this._windows.length > 0) {
|
||||
let runningBox = new Big.Box({ /* border_color: GenericDisplay.ITEM_DISPLAY_NAME_COLOR,
|
||||
border: 1,
|
||||
padding: 1 */ });
|
||||
@ -503,6 +502,16 @@ WellDisplayItem.prototype = {
|
||||
}
|
||||
},
|
||||
|
||||
_handleActivate: function () {
|
||||
if (this._windows.length == 0)
|
||||
this.launch();
|
||||
else {
|
||||
let first = this._windows[0];
|
||||
first.activate(Clutter.get_current_event_time());
|
||||
}
|
||||
this.emit('activated');
|
||||
},
|
||||
|
||||
// Opens an application represented by this display item.
|
||||
launch : function() {
|
||||
this.appInfo.launch();
|
||||
|
Reference in New Issue
Block a user