Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Support for Unity launcher

  • Loading branch information...
commit a7d6e5b9f5674113c922388756250898b71a1fc9 1 parent beb50ec
@marcoceppi marcoceppi authored
Showing with 22 additions and 0 deletions.
  1. +14 −0 assets/js/collections.js
  2. +8 −0 assets/js/views/chat_application.js
View
14 assets/js/collections.js
@@ -69,6 +69,20 @@ var WindowList = Backbone.Collection.extend({
return count;
}
+ unreadByChannel: function() {
+ var channels = this.byType('channel');
+ var pms = this.byType('pm');
+
+ var windowCounts = {};
+ $.each(channels, function(key, chat) {
+ windowCounts[chat.get('name')] = chat.get('unread');
+ });
+
+ $.each(pms, function(key, pm) {
+ windowCounts[pm.get('name')] = pm.get('unread');
+ });
+
+ return windowCounts;
});
var UserList = Backbone.Collection.extend({
View
8 assets/js/views/chat_application.js
@@ -65,8 +65,16 @@ var ChatApplicationView = Backbone.View.extend({
var unreads = irc.chatWindows.unreadCount();
if (unreads > 0)
document.title = '(' + unreads + ') ' + this.originalTitle;
+ if( window.unity.connected ) {
+ window.unity.api.Launcher.setCount(unreads);
+ window.unity.api.Launcher.setUrgent(true);
+ }
else
document.title = this.originalTitle;
+ if( window.unity.connected ) {
+ window.unity.api.Launcher.clearCount();
+ window.unity.api.Launcher.setUrgent(false);
+ }
},
playSound: function(type) {
Please sign in to comment.
Something went wrong with that request. Please try again.