notificationDaemon: Match app based on WM_CLASS

Most tray applets won't have an associated window in the same PID. We
need to fall back to the WM_CLASS in this case.

https://bugzilla.gnome.org/show_bug.cgi?id=673761
This commit is contained in:
Jasper St. Pierre
2012-04-08 22:39:59 -03:00
parent 64aa729edd
commit 2e8881b77c
4 changed files with 60 additions and 61 deletions

View File

@ -578,11 +578,27 @@ const Source = new Lang.Class({
return true;
},
_getApp: function() {
let app;
app = Shell.WindowTracker.get_default().get_app_from_pid(this.pid);
if (app != null)
return app;
if (this.trayIcon) {
app = Shell.AppSystem.get_default().lookup_wmclass(this.trayIcon.wmclass);
if (app != null)
return app;
}
return null;
},
_setApp: function() {
if (this.app)
return;
this.app = Shell.WindowTracker.get_default().get_app_from_pid(this.pid);
this.app = this._getApp();
if (!this.app)
return;