mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-19 16:10:12 +01:00
🎨 Windows 端支持窗口置顶 Fix https://github.com/siyuan-note/siyuan/issues/6860
This commit is contained in:
parent
fc1db313d2
commit
3f4e642bc3
1 changed files with 28 additions and 1 deletions
|
|
@ -472,7 +472,34 @@ const boot = () => {
|
||||||
click: () => {
|
click: () => {
|
||||||
mainWindow.webContents.send('siyuan-save-close', true)
|
mainWindow.webContents.send('siyuan-save-close', true)
|
||||||
},
|
},
|
||||||
}]
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
let changeWndTop = {}
|
||||||
|
if ('win32' === process.platform) {
|
||||||
|
// Windows 平台提供窗口置顶功能
|
||||||
|
changeWndTop = {
|
||||||
|
label: 'Set Window Top',
|
||||||
|
click: () => {
|
||||||
|
if (!mainWindow.isAlwaysOnTop()) {
|
||||||
|
mainWindow.setAlwaysOnTop(true)
|
||||||
|
changeWndTop.label = 'Cancel Window Top'
|
||||||
|
trayMenuTemplate.splice(trayMenuTemplate.length - 2, 1, changeWndTop)
|
||||||
|
const contextMenu = Menu.buildFromTemplate(trayMenuTemplate)
|
||||||
|
tray.setContextMenu(contextMenu)
|
||||||
|
} else {
|
||||||
|
mainWindow.setAlwaysOnTop(false)
|
||||||
|
changeWndTop.label = 'Set Window Top'
|
||||||
|
trayMenuTemplate.splice(trayMenuTemplate.length - 2, 1, changeWndTop)
|
||||||
|
const contextMenu = Menu.buildFromTemplate(trayMenuTemplate)
|
||||||
|
tray.setContextMenu(contextMenu)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
trayMenuTemplate.splice(trayMenuTemplate.length - 1, 0, changeWndTop)
|
||||||
|
}
|
||||||
|
|
||||||
const contextMenu = Menu.buildFromTemplate(trayMenuTemplate)
|
const contextMenu = Menu.buildFromTemplate(trayMenuTemplate)
|
||||||
tray.setContextMenu(contextMenu)
|
tray.setContextMenu(contextMenu)
|
||||||
tray.on('click', () => {
|
tray.on('click', () => {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue