From c48c80e4e990209ca7e82a719ae0f7448213a6a1 Mon Sep 17 00:00:00 2001 From: Giovanni Campagna Date: Sun, 24 Oct 2010 14:31:41 +0200 Subject: [PATCH] Allow for empty WM_CLASS and _NET_WM_NAME in tray icons The system tray specification says the hint should be set, but some icons leave it empty anyway. Don't throw exceptions in that case. https://bugzilla.gnome.org/show_bug.cgi?id=633028 --- js/ui/notificationDaemon.js | 2 +- js/ui/statusIconDispatcher.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/js/ui/notificationDaemon.js b/js/ui/notificationDaemon.js index 59c48d59f..61de6943f 100644 --- a/js/ui/notificationDaemon.js +++ b/js/ui/notificationDaemon.js @@ -372,7 +372,7 @@ NotificationDaemon.prototype = { _onTrayIconAdded: function(o, icon) { let source = this._sources[icon.pid]; if (!source) - source = this._newSource(icon.title, icon.pid); + source = this._newSource(icon.title || icon.wm_class || _("Unknown"), icon.pid); source.setTrayIcon(icon); }, diff --git a/js/ui/statusIconDispatcher.js b/js/ui/statusIconDispatcher.js index fc754c9f4..8c796acd6 100644 --- a/js/ui/statusIconDispatcher.js +++ b/js/ui/statusIconDispatcher.js @@ -36,7 +36,7 @@ StatusIconDispatcher.prototype = { }, _onTrayIconAdded: function(o, icon) { - let wmClass = icon.wm_class.toLowerCase(); + let wmClass = (icon.wm_class || 'unknown').toLowerCase(); let role = STANDARD_TRAY_ICON_IMPLEMENTATIONS[wmClass]; if (role) this.emit('status-icon-added', icon, role); @@ -45,7 +45,7 @@ StatusIconDispatcher.prototype = { }, _onTrayIconRemoved: function(o, icon) { - let wmClass = icon.wm_class.toLowerCase(); + let wmClass = (icon.wm_class || 'unknown').toLowerCase(); let role = STANDARD_TRAY_ICON_IMPLEMENTATIONS[wmClass]; if (role) this.emit('status-icon-removed', icon);