Skip to content

Commit 28ab0a5

Browse files
committed
fix: decrease app icon in macos system tray
1 parent a983b75 commit 28ab0a5

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

apps/desktop/src/tray-icon.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import { fileURLToPath } from "node:url";
77
const __dirname = dirname(fileURLToPath(import.meta.url));
88
const DEV_TRAY_ICON_PATH = resolve(__dirname, "../build/trayIcon@2x.png");
99
const PACKAGED_TRAY_ICON_PATH = resolve(__dirname, "../build/trayIcon@2x.png");
10+
const TRAY_BASE_SIZE = 64;
11+
const TRAY_ICON_SCALE = 0.6;
1012

1113
/**
1214
* Color palette for state indicator dot.
@@ -29,7 +31,8 @@ const STATE_COLORS: Record<GatewayState, [number, number, number]> = {
2931
export function createTrayIcon(state: GatewayState): NativeImage {
3032
const iconPath = app.isPackaged ? PACKAGED_TRAY_ICON_PATH : DEV_TRAY_ICON_PATH;
3133
const source = nativeImage.createFromPath(iconPath);
32-
const base = source.resize({ width: 64, height: 64 });
34+
const iconSize = Math.round(TRAY_BASE_SIZE * TRAY_ICON_SCALE);
35+
const base = source.resize({ width: iconSize, height: iconSize });
3336

3437
// Get the raw RGBA bitmap
3538
const size = base.getSize();
@@ -40,7 +43,7 @@ export function createTrayIcon(state: GatewayState): NativeImage {
4043

4144
// Draw a state indicator dot in the bottom-right corner
4245
const [r, g, b] = STATE_COLORS[state];
43-
const dotRadius = Math.round(w * 0.18); // ~18% of icon size
46+
const dotRadius = Math.round(iconSize * 0.18); // ~18% of the visible icon size
4447
const cx = w - dotRadius - 1;
4548
const cy = h - dotRadius - 1;
4649

0 commit comments

Comments
 (0)