From 992ec792cb52d22bfc4078cdbe3c3418dd9d6680 Mon Sep 17 00:00:00 2001 From: Mefsaal Date: Wed, 18 May 2022 12:54:41 -0300 Subject: [PATCH] SysTray Changes --- src/i18n/en_US.json | 1 + src/main/base/app.ts | 50 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+) diff --git a/src/i18n/en_US.json b/src/i18n/en_US.json index b3553bde..001e15cf 100644 --- a/src/i18n/en_US.json +++ b/src/i18n/en_US.json @@ -260,6 +260,7 @@ "action.tray.playpause": "Play/Pause", "action.tray.next": "Next", "action.tray.previous": "Previous", + "action.tray.listento": "Listen To:", "action.update": "Update", "action.install": "Install", "action.copy": "Copy", diff --git a/src/main/base/app.ts b/src/main/base/app.ts index 9ae6b6a9..17c55e01 100644 --- a/src/main/base/app.ts +++ b/src/main/base/app.ts @@ -299,6 +299,56 @@ export class AppEvents { this.i18n = utils.getLocale(utils.getStoreValue('general.language')) const menu = Menu.buildFromTemplate([ + + { + label: app.getName(), + enabled: false, + icon: path.join(__dirname, `../../resources/icons/icon.png`), + }, + + {type: 'separator'}, + + /* For now only idea i dont know if posible to implement + { + label: this.i18n['action.tray.listento'], + enabled: false, + }, + + { + visible: visible, + label: 'track info', + enabled: false, + }, + + {type: 'separator'}, + */ + + { + visible: (visible === false), + label: this.i18n['action.tray.playpause'], + click: () => { + utils.getWindow().webContents.executeJavaScript('MusicKitInterop.playPause()') + } + }, + + { + visible: (visible === false), + label: this.i18n['action.tray.next'], + click: () => { + utils.getWindow().webContents.executeJavaScript(`MusicKitInterop.next()`) + } + }, + + { + visible: (visible === false), + label: this.i18n['action.tray.previous'], + click: () => { + utils.getWindow().webContents.executeJavaScript(`MusicKitInterop.previous()`) + } + }, + + {type: 'separator'}, + { label: (visible ? this.i18n['action.tray.minimize'] : `${this.i18n['action.tray.show']}`), click: () => {