@@ -8,7 +8,6 @@ import { join } from 'node:path';
88import { readFileSync } from 'node:fs' ;
99import * as log from '../ts/logging/log' ;
1010import type { LocalizerType } from '../ts/types/I18N' ;
11- import { SystemThemeType } from '../ts/types/Util' ;
1211
1312export type SystemTrayServiceOptionsType = Readonly < {
1413 i18n : LocalizerType ;
@@ -276,23 +275,19 @@ function getVariantForScaleFactor(scaleFactor: number) {
276275 return match ?? Variant . Size32 ;
277276}
278277
279- function getTrayIconImagePath (
280- size : number ,
281- theme : SystemThemeType ,
282- unreadCount : number
283- ) : string {
278+ function getTrayIconImagePath ( size : number , unreadCount : number ) : string {
284279 let dirName : string ;
285280 let fileName : string ;
286281
287282 if ( unreadCount === 0 ) {
288283 dirName = 'base' ;
289- fileName = `signal-tray-icon-${ size } x${ size } -${ theme } - base.png` ;
284+ fileName = `signal-tray-icon-${ size } x${ size } -base.png` ;
290285 } else if ( unreadCount < 10 ) {
291286 dirName = 'alert' ;
292- fileName = `signal-tray-icon-${ size } x${ size } -${ theme } - alert-${ unreadCount } .png` ;
287+ fileName = `signal-tray-icon-${ size } x${ size } -alert-${ unreadCount } .png` ;
293288 } else {
294289 dirName = 'alert' ;
295- fileName = `signal-tray-icon-${ size } x${ size } -${ theme } - alert-9+.png` ;
290+ fileName = `signal-tray-icon-${ size } x${ size } -alert-9+.png` ;
296291 }
297292
298293 const iconPath = join (
@@ -310,11 +305,7 @@ function getTrayIconImagePath(
310305const TrayIconCache = new Map < string , NativeImage > ( ) ;
311306
312307function getIcon ( unreadCount : number ) {
313- const theme = nativeTheme . shouldUseDarkColors
314- ? SystemThemeType . dark
315- : SystemThemeType . light ;
316-
317- const cacheKey = `${ theme } -${ unreadCount } ` ;
308+ const cacheKey = `${ Math . min ( unreadCount , 10 ) } ` ;
318309
319310 const cached = TrayIconCache . get ( cacheKey ) ;
320311 if ( cached != null ) {
@@ -331,7 +322,7 @@ function getIcon(unreadCount: number) {
331322 // We choose the best icon based on the highest display scale factor.
332323 const scaleFactor = getDisplaysMaxScaleFactor ( ) ;
333324 const variant = getVariantForScaleFactor ( scaleFactor ) ;
334- const iconPath = getTrayIconImagePath ( variant . size , theme , unreadCount ) ;
325+ const iconPath = getTrayIconImagePath ( variant . size , unreadCount ) ;
335326 const buffer = readFileSync ( iconPath ) ;
336327 image = nativeImage . createFromBuffer ( buffer , {
337328 scaleFactor : 1.0 , // Must be 1.0 for Linux
@@ -343,7 +334,7 @@ function getIcon(unreadCount: number) {
343334 image = nativeImage . createEmpty ( ) ;
344335
345336 for ( const variant of Variants ) {
346- const iconPath = getTrayIconImagePath ( variant . size , theme , unreadCount ) ;
337+ const iconPath = getTrayIconImagePath ( variant . size , unreadCount ) ;
347338 const buffer = readFileSync ( iconPath ) ;
348339 image . addRepresentation ( {
349340 buffer,
0 commit comments