From 539a942906d2c7cc64bb6c515f6fa03874d05738 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=87=E5=A4=A9?= Date: Sun, 13 Dec 2020 21:28:00 +0800 Subject: [PATCH] update --- package.json | 2 +- src/tools/tray.js | 13 +++++++++---- src/tools/windows.js | 4 ++-- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 2251346..d37b1ac 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "top.yutent.sonist", - "version": "2.0.0-alpha-2", + "version": "2.0.0-alpha-3", "description": "Music Player", "main": "src/main.js", "scripts": { diff --git a/src/tools/tray.js b/src/tools/tray.js index 1c13cb4..1c07a85 100644 --- a/src/tools/tray.js +++ b/src/tools/tray.js @@ -21,7 +21,7 @@ function create(ico = nativeImage.createEmpty()) { return tray } -exports.ctrlTrayBtn = function(win) { +exports.ctrlTrayBtn = function (win) { var next = create(ICON_DICT.next) var play = create(ICON_DICT.pause) var prev = create(ICON_DICT.prev) @@ -42,11 +42,14 @@ exports.ctrlTrayBtn = function(win) { next.on('click', _ => { win.webContents.send('app', { type: 'tray-next', data: { isPlaying } }) }) - console.log('ready', prev, play, next) + + win.__prev__ = prev + win.__play__ = play + win.__next__ = next return { prev, play, next } } -exports.createAppTray = function(win) { +exports.createAppTray = function (win) { var tray = create(ICON_DICT.app) var menuList = Menu.buildFromTemplate([ { @@ -65,12 +68,14 @@ exports.createAppTray = function(win) { tray.popUpContextMenu(menuList) }) + win.__tray__ = tray return tray } -exports.createLrcTray = function(win) { +exports.createLrcTray = function (win) { var tray = create() tray.setTitle('这是顶栏歌词, blablablabla...') + win.__lrc__ = tray return tray } diff --git a/src/tools/windows.js b/src/tools/windows.js index 9c2aee4..2714913 100644 --- a/src/tools/windows.js +++ b/src/tools/windows.js @@ -12,7 +12,7 @@ const createMenu = require('./menu.js') /** * 应用主窗口 */ -exports.createMainWindow = function(icon) { +exports.createMainWindow = function (icon) { // 创建浏览器窗口 let win = new BrowserWindow({ title: 'sonist', @@ -61,7 +61,7 @@ exports.createMainWindow = function(icon) { /** * 应用迷你窗口 */ -exports.createMiniWindow = function(screen) { +exports.createMiniWindow = function (screen) { let win = new BrowserWindow({ title: '', width: 320,