From 82e9b82e2379ca8a1da4e20b6a19795d03693b3b Mon Sep 17 00:00:00 2001 From: Samuel Elliott Date: Thu, 30 Jun 2022 16:22:02 +0100 Subject: [PATCH] Add menu/tray icon --- package.json | 6 +++++- resources/app/menu-icon.png | Bin 0 -> 655 bytes src/app/main/menu.ts | 16 +++++++++------- 3 files changed, 14 insertions(+), 8 deletions(-) create mode 100644 resources/app/menu-icon.png diff --git a/package.json b/package.json index 01d0283..3875592 100644 --- a/package.json +++ b/package.json @@ -13,6 +13,8 @@ "dist", "!dist/app", "!dist/bundle", + "resources/cli/**/*", + "resources/common/**/*", "bin" ], "bin": { @@ -85,7 +87,9 @@ "dist/app/bundle", "dist/bundle", "!dist/app/package", - "!**/node_modules/**/*" + "!**/node_modules/**/*", + "resources/app/**/*", + "resources/common/**/*" ], "asar": false, "extraMetadata": { diff --git a/resources/app/menu-icon.png b/resources/app/menu-icon.png new file mode 100644 index 0000000000000000000000000000000000000000..50d159f0d7eaa30a568c461b3b789b169e085678 GIT binary patch literal 655 zcmV;A0&x9_P)6jud@K z0lIM!n{Y6aLiqAImJ`@jU}U3z{{v||JvVW^#&7?q%{rAxUsbF@E}oGi5&vlhxk?jiT)b;V&`cxuo?HUI`${96R%4quptw6HB2W1BZ+h9#kG>1 z!>UXpChN(-))va!Dj?96%dju@@8D%83BZfk zDn${2GVloZqMzN^(n$g%IIa<0S8)^jQ>DC3xKw<_N%KSd7mmhfINV6h*$?zd|w*LnLt5whL>0_7?&mf^aPmW%K0((9FPD2 literal 0 HcmV?d00001 diff --git a/src/app/main/menu.ts b/src/app/main/menu.ts index 71e7840..110e2c8 100644 --- a/src/app/main/menu.ts +++ b/src/app/main/menu.ts @@ -1,4 +1,5 @@ import { app, dialog, Menu, Tray, nativeImage, MenuItem } from './electron.js'; +import path from 'node:path'; import createDebug from 'debug'; import { askAddNsoAccount, askAddPctlAccount } from './na-auth.js'; import { App } from './index.js'; @@ -6,20 +7,21 @@ import { WebService } from '../../api/coral-types.js'; import openWebService from './webservices.js'; import { SavedToken } from '../../common/auth/nso.js'; import { SavedMoonToken } from '../../common/auth/moon.js'; -import { dev } from '../../util/product.js'; +import { dev, dir } from '../../util/product.js'; import { EmbeddedPresenceMonitor, EmbeddedProxyPresenceMonitor } from './monitor.js'; const debug = createDebug('app:main:menu'); +const icon = nativeImage + .createFromPath(path.join(dir, 'resources', 'app', 'menu-icon.png')) + .resize({height: 16}); + +icon.setTemplateImage(true); + export default class MenuApp { - tray: Tray; + tray = new Tray(icon); constructor(readonly app: App) { - const icon = nativeImage.createEmpty(); - - this.tray = new Tray(icon); - - this.tray.setTitle('nxapi'); this.tray.setToolTip('nxapi'); app.store.on('update-nintendo-accounts', () => this.updateMenu());