Commit e5057669 authored by rocosen's avatar rocosen

Update main.ts

parent cb65c10a
......@@ -39,31 +39,30 @@ const getAssetPath = (...paths: string[]): string => {
return path.join(RESOURCES_PATH, ...paths);
};
const exeName = path.basename(process.execPath)
const exeName = path.basename(process.execPath);
let image:any
let image: any;
if (process.platform === 'darwin') {
image = nativeImage.createFromPath(getAssetPath('/img/iconTemplate.png'));
}else{
image = nativeImage.createFromPath(getAssetPath('/img/iconwinTemplate.png'));
} else {
image = nativeImage.createFromPath(
getAssetPath('/img/iconwinTemplate.png')
);
}
Menu.setApplicationMenu(null);
const gotTheLock = app.requestSingleInstanceLock()
const gotTheLock = app.requestSingleInstanceLock();
if (!gotTheLock) {
app.quit()
app.quit();
}
app.setLoginItemSettings({
openAtLogin: true,
openAsHidden:false,
openAsHidden: false,
path: process.execPath,
args: [
'--processStart', `"${exeName}"`,
]
})
args: ['--processStart', `"${exeName}"`],
});
ipcMain.on('createNewWindow-site', (event, arg) => {
if (siteWindown) {
......@@ -177,10 +176,10 @@ const createWindow = async () => {
frame: true,
resizable: false,
titleBarStyle: 'hidden',
maximizable:false,
maximizable: false,
titleBarOverlay: {
color: '#ffffff',
height: 30
height: 30,
},
webPreferences: {
sandbox: false,
......@@ -196,13 +195,12 @@ const createWindow = async () => {
label: '退出',
click: async () => {
app.quit();
}
},
])
tray.setContextMenu(contextMenu)
},
]);
tray.setContextMenu(contextMenu);
// tray.setTitle('test');
tray.setToolTip('北鲲云')
tray.setToolTip('北鲲云');
mainWindow.loadURL(resolveHtmlPath('index.html'));
// mainWindow.webContents.openDevTools();
......@@ -245,11 +243,10 @@ const createWindow = async () => {
positioner.position(homeWindown, tray.getBounds(), alignment);
});
tray.on('right-click', function (){
tray.on('right-click', function () {
if (!tray) return;
tray.popUpContextMenu();
});
};
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment