mirror of
https://github.com/viarotel-org/escrcpy.git
synced 2025-02-10 15:52:57 +01:00
25 lines
635 B
JavaScript
25 lines
635 B
JavaScript
|
import { BrowserWindow, ipcMain, Menu } from 'electron'
|
||
|
|
||
|
export default function (controlWindow) {
|
||
|
ipcMain.handle('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))
|
||
|
}
|
||
|
}
|