This commit is contained in:
Liang Ding 2022-12-13 00:02:15 +08:00
parent 1e8b027434
commit 06d2956022
No known key found for this signature in database
GPG key ID: 136F30F901A2231D

View file

@ -444,19 +444,25 @@ const boot = () => {
if (mainWindow.isMinimized()) { if (mainWindow.isMinimized()) {
mainWindow.restore() mainWindow.restore()
} }
mainWindow.show()
if ('win32' === process.platform || 'linux' === process.platform) {
showWndMenu.label = "Hide Window" showWndMenu.label = "Hide Window"
trayMenuTemplate.splice(0, 1, showWndMenu) trayMenuTemplate.splice(0, 1, showWndMenu)
const contextMenu = Menu.buildFromTemplate(trayMenuTemplate) const contextMenu = Menu.buildFromTemplate(trayMenuTemplate)
tray.setContextMenu(contextMenu) tray.setContextMenu(contextMenu)
mainWindow.show() }
} else { } else {
mainWindow.hide() mainWindow.hide()
if ('win32' === process.platform || 'linux' === process.platform) {
showWndMenu.label = "Show Window" showWndMenu.label = "Show Window"
trayMenuTemplate.splice(0, 1, showWndMenu) trayMenuTemplate.splice(0, 1, showWndMenu)
const contextMenu = Menu.buildFromTemplate(trayMenuTemplate) const contextMenu = Menu.buildFromTemplate(trayMenuTemplate)
tray.setContextMenu(contextMenu) tray.setContextMenu(contextMenu)
} }
} }
}
ipcMain.on('siyuan-hotkey', (event, hotkey) => { ipcMain.on('siyuan-hotkey', (event, hotkey) => {
globalShortcut.unregisterAll() globalShortcut.unregisterAll()