From 3dbb0cf240efa232ba376cbb31d96288fbef6794 Mon Sep 17 00:00:00 2001 From: life Date: Sun, 28 Mar 2021 09:22:06 +0800 Subject: [PATCH] fix two tray on windows --- main.js | 8 ++++++++ public/js/app/page.js | 3 +++ public/js/common.js | 4 ++-- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/main.js b/main.js index 7367afc1..aaf7b989 100644 --- a/main.js +++ b/main.js @@ -232,6 +232,10 @@ function openIt() { ipc.on('openUrl', function(event, arg) { console.log('openUrl', arg); + // if (appIcon) { + // appIcon.destroy() + // } + arg.webPreferences = arg.webPreferences === undefined ? {} : arg.webPreferences; arg.webPreferences.nodeIntegration = true; arg.webPreferences.contextIsolation = false; @@ -268,6 +272,8 @@ function openIt() { } } + // tray只要实例化一次 + // tray在windows下可能会有两个, 原因不明, 当注销后再启动 var trayShowed = false; ipc.on('show-tray', function(event, arg) { if (trayShowed) { @@ -279,6 +285,8 @@ function openIt() { return; } + console.log('show tray') + appIcon = new Tray(__dirname + '/public/images/tray/' + ( process.platform == 'darwin' ? 'trayTemplate.png' : 'tray.png')) var contextMenu = Menu.buildFromTemplate([ { diff --git a/public/js/app/page.js b/public/js/app/page.js index 5831b83e..26d335f1 100644 --- a/public/js/app/page.js +++ b/public/js/app/page.js @@ -1409,6 +1409,9 @@ function showLocalAccountWarning() { function initPage(initedCallback) { console.log('init page'); + // 不要显示顶部菜单 + gui.Menu.setApplicationMenu(null) + // 笔记本, 事件, menu初始化 Notebook.init(); // 笔记 diff --git a/public/js/common.js b/public/js/common.js index eb5d0c57..474e4b38 100644 --- a/public/js/common.js +++ b/public/js/common.js @@ -1579,7 +1579,7 @@ function isMac() { function getMainWinParams() { if(isMac()) { return { - "icon": "/public/images/logo/leanote.png", + // "icon": "/public/images/logo/leanote.png", frame: false, transparent: false, width: 258, @@ -1589,7 +1589,7 @@ function getMainWinParams() { }; } return { - "icon": "/public/images/logo/leanote.png", + // "icon": "/public/images/logo/leanote.png", frame: true, transparent: false, width: 1100,