feat(tray): black icon for macOS

This commit is contained in:
Elian Doran 2025-02-01 12:49:01 +02:00
parent c80bf48d13
commit 6db51d648b
No known key found for this signature in database
6 changed files with 10 additions and 15 deletions

View File

@ -23,6 +23,7 @@ function generateDpiScaledIcons {
inkscape -w 32 -h 32 "$file" -o "$output_dir/$name@2x.png"
}
generateDpiScaledIcons "$images_dir/icon-black.svg"
generateDpiScaledIcons "$images_dir/icon-color.svg"
generateDpiScaledIcons "$images_dir/icon-purple.svg"

Binary file not shown.

After

Width:  |  Height:  |  Size: 390 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 490 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 589 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 728 B

View File

@ -11,7 +11,7 @@ import becca_service from "../becca/becca_service.js";
import type BRecentNote from "../becca/entities/brecent_note.js";
import { ipcMain, nativeTheme } from "electron/main";
import { default as i18next, t } from "i18next";
import { isDev } from "./utils.js";
import { isDev, isMac } from "./utils.js";
import cls from "./cls.js";
let tray: Tray;
@ -19,21 +19,15 @@ let tray: Tray;
// is minimized
let isVisible = true;
// Inspired by https://github.com/signalapp/Signal-Desktop/blob/dcb5bb672635c4b29a51adec8a5658e3834ec8fc/app/tray_icon.ts#L20
function getIconSize() {
switch (process.platform) {
case "darwin":
return 16;
case "win32":
return 32;
default:
return 256;
}
}
function getTrayIconPath() {
const iconSize = getIconSize();
const name = isDev ? "icon-purple" : "icon-color";
let name: string;
if (isMac) {
name = "icon-black";
} else if (isDev) {
name = "icon-purple";
} else {
name = "icon-color";
}
return path.join(path.dirname(fileURLToPath(import.meta.url)), "../..", "images", "app-icons", "tray", `${name}.png`);
}