mirror of
https://github.com/leanote/desktop-app.git
synced 2025-10-20 02:31:23 +00:00
fix two tray on windows
This commit is contained in:
8
main.js
8
main.js
@@ -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([
|
||||||
{
|
{
|
||||||
|
@@ -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();
|
||||||
// 笔记
|
// 笔记
|
||||||
|
@@ -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,
|
||||||
|
Reference in New Issue
Block a user