mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-02-27 18:22:41 -08:00
fix(tray): add macOS template tray icon assets
This commit is contained in:
BIN
assets/SubMinerTemplate.png
Normal file
BIN
assets/SubMinerTemplate.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 433 B |
BIN
assets/SubMinerTemplate@2x.png
Normal file
BIN
assets/SubMinerTemplate@2x.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 580 B |
19
src/main.ts
19
src/main.ts
@@ -2709,12 +2709,21 @@ function createInvisibleWindow(): BrowserWindow {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function resolveTrayIconPath(): string | null {
|
function resolveTrayIconPath(): string | null {
|
||||||
const candidates = [
|
const iconNames =
|
||||||
path.join(process.resourcesPath, 'assets', 'SubMiner.png'),
|
process.platform === 'darwin'
|
||||||
path.join(app.getAppPath(), 'assets', 'SubMiner.png'),
|
? ['SubMinerTemplate.png', 'SubMinerTemplate@2x.png', 'SubMiner.png']
|
||||||
path.join(__dirname, '..', 'assets', 'SubMiner.png'),
|
: ['SubMiner.png'];
|
||||||
path.join(__dirname, '..', '..', 'assets', 'SubMiner.png'),
|
|
||||||
|
const baseDirs = [
|
||||||
|
path.join(process.resourcesPath, 'assets'),
|
||||||
|
path.join(app.getAppPath(), 'assets'),
|
||||||
|
path.join(__dirname, '..', 'assets'),
|
||||||
|
path.join(__dirname, '..', '..', 'assets'),
|
||||||
];
|
];
|
||||||
|
|
||||||
|
const candidates = baseDirs.flatMap((baseDir) =>
|
||||||
|
iconNames.map((iconName) => path.join(baseDir, iconName)),
|
||||||
|
);
|
||||||
for (const candidate of candidates) {
|
for (const candidate of candidates) {
|
||||||
if (fs.existsSync(candidate)) {
|
if (fs.existsSync(candidate)) {
|
||||||
return candidate;
|
return candidate;
|
||||||
|
|||||||
Reference in New Issue
Block a user