Update icon assets
Co-authored-by: Jamie Kyle <113370520+jamiebuilds-signal@users.noreply.github.com>
|
@ -8,7 +8,6 @@ import { join } from 'node:path';
|
|||
import { readFileSync } from 'node:fs';
|
||||
import * as log from '../ts/logging/log';
|
||||
import type { LocalizerType } from '../ts/types/I18N';
|
||||
import { SystemThemeType } from '../ts/types/Util';
|
||||
|
||||
export type SystemTrayServiceOptionsType = Readonly<{
|
||||
i18n: LocalizerType;
|
||||
|
@ -276,23 +275,19 @@ function getVariantForScaleFactor(scaleFactor: number) {
|
|||
return match ?? Variant.Size32;
|
||||
}
|
||||
|
||||
function getTrayIconImagePath(
|
||||
size: number,
|
||||
theme: SystemThemeType,
|
||||
unreadCount: number
|
||||
): string {
|
||||
function getTrayIconImagePath(size: number, unreadCount: number): string {
|
||||
let dirName: string;
|
||||
let fileName: string;
|
||||
|
||||
if (unreadCount === 0) {
|
||||
dirName = 'base';
|
||||
fileName = `signal-tray-icon-${size}x${size}-${theme}-base.png`;
|
||||
fileName = `signal-tray-icon-${size}x${size}-base.png`;
|
||||
} else if (unreadCount < 10) {
|
||||
dirName = 'alert';
|
||||
fileName = `signal-tray-icon-${size}x${size}-${theme}-alert-${unreadCount}.png`;
|
||||
fileName = `signal-tray-icon-${size}x${size}-alert-${unreadCount}.png`;
|
||||
} else {
|
||||
dirName = 'alert';
|
||||
fileName = `signal-tray-icon-${size}x${size}-${theme}-alert-9+.png`;
|
||||
fileName = `signal-tray-icon-${size}x${size}-alert-9+.png`;
|
||||
}
|
||||
|
||||
const iconPath = join(
|
||||
|
@ -310,11 +305,7 @@ function getTrayIconImagePath(
|
|||
const TrayIconCache = new Map<string, NativeImage>();
|
||||
|
||||
function getIcon(unreadCount: number) {
|
||||
const theme = nativeTheme.shouldUseDarkColors
|
||||
? SystemThemeType.dark
|
||||
: SystemThemeType.light;
|
||||
|
||||
const cacheKey = `${theme}-${unreadCount}`;
|
||||
const cacheKey = `${Math.min(unreadCount, 10)}`;
|
||||
|
||||
const cached = TrayIconCache.get(cacheKey);
|
||||
if (cached != null) {
|
||||
|
@ -331,7 +322,7 @@ function getIcon(unreadCount: number) {
|
|||
// We choose the best icon based on the highest display scale factor.
|
||||
const scaleFactor = getDisplaysMaxScaleFactor();
|
||||
const variant = getVariantForScaleFactor(scaleFactor);
|
||||
const iconPath = getTrayIconImagePath(variant.size, theme, unreadCount);
|
||||
const iconPath = getTrayIconImagePath(variant.size, unreadCount);
|
||||
const buffer = readFileSync(iconPath);
|
||||
image = nativeImage.createFromBuffer(buffer, {
|
||||
scaleFactor: 1.0, // Must be 1.0 for Linux
|
||||
|
@ -343,7 +334,7 @@ function getIcon(unreadCount: number) {
|
|||
image = nativeImage.createEmpty();
|
||||
|
||||
for (const variant of Variants) {
|
||||
const iconPath = getTrayIconImagePath(variant.size, theme, unreadCount);
|
||||
const iconPath = getTrayIconImagePath(variant.size, unreadCount);
|
||||
const buffer = readFileSync(iconPath);
|
||||
image.addRepresentation({
|
||||
buffer,
|
||||
|
|
BIN
build/icon.ico
Before Width: | Height: | Size: 188 KiB After Width: | Height: | Size: 188 KiB |
BIN
images/tray-icons/alert/signal-tray-icon-16x16-alert-1.png
Normal file
After Width: | Height: | Size: 501 B |
BIN
images/tray-icons/alert/signal-tray-icon-16x16-alert-2.png
Normal file
After Width: | Height: | Size: 548 B |
BIN
images/tray-icons/alert/signal-tray-icon-16x16-alert-3.png
Normal file
After Width: | Height: | Size: 559 B |
BIN
images/tray-icons/alert/signal-tray-icon-16x16-alert-4.png
Normal file
After Width: | Height: | Size: 522 B |
BIN
images/tray-icons/alert/signal-tray-icon-16x16-alert-5.png
Normal file
After Width: | Height: | Size: 554 B |
BIN
images/tray-icons/alert/signal-tray-icon-16x16-alert-6.png
Normal file
After Width: | Height: | Size: 572 B |
BIN
images/tray-icons/alert/signal-tray-icon-16x16-alert-7.png
Normal file
After Width: | Height: | Size: 525 B |
BIN
images/tray-icons/alert/signal-tray-icon-16x16-alert-8.png
Normal file
After Width: | Height: | Size: 572 B |
BIN
images/tray-icons/alert/signal-tray-icon-16x16-alert-9+.png
Normal file
After Width: | Height: | Size: 566 B |
BIN
images/tray-icons/alert/signal-tray-icon-16x16-alert-9.png
Normal file
After Width: | Height: | Size: 564 B |
Before Width: | Height: | Size: 413 B |
Before Width: | Height: | Size: 460 B |
Before Width: | Height: | Size: 468 B |
Before Width: | Height: | Size: 437 B |
Before Width: | Height: | Size: 463 B |
Before Width: | Height: | Size: 479 B |
Before Width: | Height: | Size: 435 B |
Before Width: | Height: | Size: 481 B |
Before Width: | Height: | Size: 500 B |
Before Width: | Height: | Size: 477 B |
Before Width: | Height: | Size: 464 B |
Before Width: | Height: | Size: 512 B |
Before Width: | Height: | Size: 518 B |
Before Width: | Height: | Size: 489 B |
Before Width: | Height: | Size: 515 B |
Before Width: | Height: | Size: 533 B |
Before Width: | Height: | Size: 486 B |
Before Width: | Height: | Size: 536 B |
Before Width: | Height: | Size: 534 B |
Before Width: | Height: | Size: 530 B |
BIN
images/tray-icons/alert/signal-tray-icon-256x256-alert-1.png
Normal file
After Width: | Height: | Size: 25 KiB |
BIN
images/tray-icons/alert/signal-tray-icon-256x256-alert-2.png
Normal file
After Width: | Height: | Size: 25 KiB |
BIN
images/tray-icons/alert/signal-tray-icon-256x256-alert-3.png
Normal file
After Width: | Height: | Size: 26 KiB |
BIN
images/tray-icons/alert/signal-tray-icon-256x256-alert-4.png
Normal file
After Width: | Height: | Size: 25 KiB |
BIN
images/tray-icons/alert/signal-tray-icon-256x256-alert-5.png
Normal file
After Width: | Height: | Size: 25 KiB |
BIN
images/tray-icons/alert/signal-tray-icon-256x256-alert-6.png
Normal file
After Width: | Height: | Size: 26 KiB |
BIN
images/tray-icons/alert/signal-tray-icon-256x256-alert-7.png
Normal file
After Width: | Height: | Size: 25 KiB |
BIN
images/tray-icons/alert/signal-tray-icon-256x256-alert-8.png
Normal file
After Width: | Height: | Size: 26 KiB |
BIN
images/tray-icons/alert/signal-tray-icon-256x256-alert-9+.png
Normal file
After Width: | Height: | Size: 25 KiB |
BIN
images/tray-icons/alert/signal-tray-icon-256x256-alert-9.png
Normal file
After Width: | Height: | Size: 26 KiB |
Before Width: | Height: | Size: 6.8 KiB |
Before Width: | Height: | Size: 7.3 KiB |
Before Width: | Height: | Size: 7.5 KiB |
Before Width: | Height: | Size: 7.1 KiB |
Before Width: | Height: | Size: 7.4 KiB |
Before Width: | Height: | Size: 7.7 KiB |
Before Width: | Height: | Size: 7.1 KiB |
Before Width: | Height: | Size: 7.7 KiB |
Before Width: | Height: | Size: 7.8 KiB |
Before Width: | Height: | Size: 7.7 KiB |
Before Width: | Height: | Size: 7.3 KiB |
Before Width: | Height: | Size: 7.9 KiB |
Before Width: | Height: | Size: 8 KiB |
Before Width: | Height: | Size: 7.5 KiB |
Before Width: | Height: | Size: 8 KiB |
Before Width: | Height: | Size: 8.3 KiB |
Before Width: | Height: | Size: 7.5 KiB |
Before Width: | Height: | Size: 8.2 KiB |
Before Width: | Height: | Size: 8.3 KiB |
Before Width: | Height: | Size: 8.3 KiB |
BIN
images/tray-icons/alert/signal-tray-icon-32x32-alert-1.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
images/tray-icons/alert/signal-tray-icon-32x32-alert-2.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
images/tray-icons/alert/signal-tray-icon-32x32-alert-3.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
images/tray-icons/alert/signal-tray-icon-32x32-alert-4.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
images/tray-icons/alert/signal-tray-icon-32x32-alert-5.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
images/tray-icons/alert/signal-tray-icon-32x32-alert-6.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
images/tray-icons/alert/signal-tray-icon-32x32-alert-7.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
images/tray-icons/alert/signal-tray-icon-32x32-alert-8.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
images/tray-icons/alert/signal-tray-icon-32x32-alert-9+.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
images/tray-icons/alert/signal-tray-icon-32x32-alert-9.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 859 B |
Before Width: | Height: | Size: 955 B |
Before Width: | Height: | Size: 979 B |
Before Width: | Height: | Size: 925 B |
Before Width: | Height: | Size: 960 B |
Before Width: | Height: | Size: 988 B |
Before Width: | Height: | Size: 914 B |
Before Width: | Height: | Size: 992 B |
Before Width: | Height: | Size: 1,021 B |
Before Width: | Height: | Size: 990 B |
Before Width: | Height: | Size: 916 B |
Before Width: | Height: | Size: 1 KiB |
Before Width: | Height: | Size: 1 KiB |
Before Width: | Height: | Size: 997 B |
Before Width: | Height: | Size: 1 KiB |
Before Width: | Height: | Size: 1 KiB |
Before Width: | Height: | Size: 987 B |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.1 KiB |
BIN
images/tray-icons/alert/signal-tray-icon-48x48-alert-1.png
Normal file
After Width: | Height: | Size: 1.7 KiB |
BIN
images/tray-icons/alert/signal-tray-icon-48x48-alert-2.png
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
images/tray-icons/alert/signal-tray-icon-48x48-alert-3.png
Normal file
After Width: | Height: | Size: 1.9 KiB |
BIN
images/tray-icons/alert/signal-tray-icon-48x48-alert-4.png
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
images/tray-icons/alert/signal-tray-icon-48x48-alert-5.png
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
images/tray-icons/alert/signal-tray-icon-48x48-alert-6.png
Normal file
After Width: | Height: | Size: 1.9 KiB |
BIN
images/tray-icons/alert/signal-tray-icon-48x48-alert-7.png
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
images/tray-icons/alert/signal-tray-icon-48x48-alert-8.png
Normal file
After Width: | Height: | Size: 1.9 KiB |