mirror of
https://github.com/viarotel-org/escrcpy.git
synced 2025-02-04 05:05:29 +01:00
22 lines
585 B
JavaScript
22 lines
585 B
JavaScript
import { BrowserWindow, ipcMain, Menu } from 'electron'
|
|
|
|
export default function (controlWindow) {
|
|
ipcMain.handle('open-device-volume-menu', openDeviceVolumeMenu)
|
|
|
|
function openDeviceVolumeMenu(event, args = {}) {
|
|
const { options = [] } = args
|
|
|
|
const template = options.map((item) => {
|
|
return {
|
|
label: item.label,
|
|
click() {
|
|
controlWindow.webContents.send('execute-device-volume-shell', item.value)
|
|
},
|
|
}
|
|
})
|
|
|
|
const menu = Menu.buildFromTemplate(template)
|
|
menu.popup(BrowserWindow.fromWebContents(event.sender))
|
|
}
|
|
}
|