mirror of
https://github.com/viarotel-org/escrcpy.git
synced 2025-02-03 20:55:38 +01:00
25 lines
640 B
JavaScript
25 lines
640 B
JavaScript
import { BrowserWindow, ipcMain, Menu } from 'electron'
|
|
import { openControlWindow } from '$control/electron/helpers/index.js'
|
|
|
|
export default function (controlWindow) {
|
|
ipcMain.handle('open-control-device-menu', (event, deviceList) => {
|
|
const template = deviceList.map((item) => {
|
|
let label = item.$remark || item.$name
|
|
|
|
if (item.$wifi) {
|
|
label += ` (WIFI)`
|
|
}
|
|
|
|
return {
|
|
label,
|
|
click: () => {
|
|
openControlWindow(controlWindow, item)
|
|
},
|
|
}
|
|
})
|
|
|
|
const menu = Menu.buildFromTemplate(template)
|
|
menu.popup(BrowserWindow.fromWebContents(event.sender))
|
|
})
|
|
}
|