File tree 1 file changed +13
-5
lines changed
1 file changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -260,12 +260,20 @@ function countUnread(mutationsList: MutationRecord[]): void {
260
260
}
261
261
262
262
async function updateTrayIcon ( ) : Promise < void > {
263
- const chatsIcon = await elementReady ( selectors . chatsIcon , {
264
- stopOnDomReady : false ,
265
- } ) ;
263
+ let messageCount = 0 ;
264
+
265
+ await elementReady ( selectors . chatsIcon , { stopOnDomReady : false } ) ;
266
+
267
+ // Count unread messages in Chats, Marketplace, etc.
268
+ for ( const element of document . querySelectorAll < HTMLElement > ( selectors . chatsIcon ) ) {
269
+ // Extract messageNumber from ariaLabel
270
+ const messageNumber = element ?. ariaLabel ?. match ( / \d + / g) ;
271
+
272
+ if ( messageNumber ) {
273
+ messageCount += Number . parseInt ( messageNumber [ 0 ] , 10 ) ;
274
+ }
275
+ }
266
276
267
- // Extract messageCount from ariaLabel
268
- const messageCount = chatsIcon ?. ariaLabel ?. match ( / \d + / g) ?? 0 ;
269
277
ipc . callMain ( 'update-tray-icon' , messageCount ) ;
270
278
}
271
279
You can’t perform that action at this time.
0 commit comments