美化右键菜单
This commit is contained in:
+8
-20
@@ -44,26 +44,14 @@ function createFloatingWindow(): void {
|
||||
}
|
||||
})
|
||||
|
||||
// Handle context menu
|
||||
ipcMain.on('show-context-menu', () => {
|
||||
if (floatingWindow) {
|
||||
const { Menu } = require('electron')
|
||||
const menu = Menu.buildFromTemplate([
|
||||
{
|
||||
label: '设置',
|
||||
click: () => {
|
||||
createSettingsWindow()
|
||||
}
|
||||
},
|
||||
{
|
||||
label: '退出',
|
||||
click: () => {
|
||||
app.quit()
|
||||
}
|
||||
}
|
||||
])
|
||||
menu.popup({ window: floatingWindow })
|
||||
}
|
||||
// Handle open settings from renderer
|
||||
ipcMain.on('open-settings', () => {
|
||||
createSettingsWindow()
|
||||
})
|
||||
|
||||
// Handle quit app from renderer
|
||||
ipcMain.on('quit-app', () => {
|
||||
app.quit()
|
||||
})
|
||||
|
||||
// Load the floating window HTML
|
||||
|
||||
Reference in New Issue
Block a user