Add menu/tray icon

This commit is contained in:
Samuel Elliott 2022-06-30 16:22:02 +01:00
parent bb606cfa7b
commit 82e9b82e23
No known key found for this signature in database
GPG Key ID: 8420C7CDE43DC4D6
3 changed files with 14 additions and 8 deletions

View File

@ -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": {

BIN
resources/app/menu-icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 655 B

View File

@ -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());