mirror of
https://github.com/viarotel-org/escrcpy.git
synced 2025-02-09 15:28:32 +01:00
25 lines
631 B
JavaScript
25 lines
631 B
JavaScript
import { BrowserWindow, ipcMain, Menu } from 'electron'
|
|
|
|
export default function (controlWindow) {
|
|
ipcMain.on('open-device-rotation-menu', openDeviceRotationMenu)
|
|
|
|
function openDeviceRotationMenu(event, args = {}) {
|
|
const { options = [] } = args
|
|
|
|
const template = options.map((item) => {
|
|
return {
|
|
label: item.label,
|
|
click: () => {
|
|
controlWindow.webContents.send(
|
|
'execute-device-rotation-shell',
|
|
item.value,
|
|
)
|
|
},
|
|
}
|
|
})
|
|
|
|
const menu = Menu.buildFromTemplate(template)
|
|
menu.popup(BrowserWindow.fromWebContents(event.sender))
|
|
}
|
|
}
|