fix two tray on windows

This commit is contained in:
life
2021-03-28 09:22:06 +08:00
parent e83689c756
commit 3dbb0cf240
3 changed files with 13 additions and 2 deletions

View File

@@ -232,6 +232,10 @@ function openIt() {
ipc.on('openUrl', function(event, arg) { ipc.on('openUrl', function(event, arg) {
console.log('openUrl', arg); console.log('openUrl', arg);
// if (appIcon) {
// appIcon.destroy()
// }
arg.webPreferences = arg.webPreferences === undefined ? {} : arg.webPreferences; arg.webPreferences = arg.webPreferences === undefined ? {} : arg.webPreferences;
arg.webPreferences.nodeIntegration = true; arg.webPreferences.nodeIntegration = true;
arg.webPreferences.contextIsolation = false; arg.webPreferences.contextIsolation = false;
@@ -268,6 +272,8 @@ function openIt() {
} }
} }
// tray只要实例化一次
// tray在windows下可能会有两个, 原因不明, 当注销后再启动
var trayShowed = false; var trayShowed = false;
ipc.on('show-tray', function(event, arg) { ipc.on('show-tray', function(event, arg) {
if (trayShowed) { if (trayShowed) {
@@ -279,6 +285,8 @@ function openIt() {
return; return;
} }
console.log('show tray')
appIcon = new Tray(__dirname + '/public/images/tray/' + ( process.platform == 'darwin' ? 'trayTemplate.png' : 'tray.png')) appIcon = new Tray(__dirname + '/public/images/tray/' + ( process.platform == 'darwin' ? 'trayTemplate.png' : 'tray.png'))
var contextMenu = Menu.buildFromTemplate([ var contextMenu = Menu.buildFromTemplate([
{ {

View File

@@ -1409,6 +1409,9 @@ function showLocalAccountWarning() {
function initPage(initedCallback) { function initPage(initedCallback) {
console.log('init page'); console.log('init page');
// 不要显示顶部菜单
gui.Menu.setApplicationMenu(null)
// 笔记本, 事件, menu初始化 // 笔记本, 事件, menu初始化
Notebook.init(); Notebook.init();
// 笔记 // 笔记

View File

@@ -1579,7 +1579,7 @@ function isMac() {
function getMainWinParams() { function getMainWinParams() {
if(isMac()) { if(isMac()) {
return { return {
"icon": "/public/images/logo/leanote.png", // "icon": "/public/images/logo/leanote.png",
frame: false, frame: false,
transparent: false, transparent: false,
width: 258, width: 258,
@@ -1589,7 +1589,7 @@ function getMainWinParams() {
}; };
} }
return { return {
"icon": "/public/images/logo/leanote.png", // "icon": "/public/images/logo/leanote.png",
frame: true, frame: true,
transparent: false, transparent: false,
width: 1100, width: 1100,