mirror of
https://github.com/viarotel-org/escrcpy.git
synced 2024-11-27 17:00:53 +01:00
39 lines
966 B
JavaScript
39 lines
966 B
JavaScript
import { BrowserWindow, ipcMain } from 'electron'
|
|
import { initControlWindow, openControlWindow } from './helpers/index.js'
|
|
|
|
import { menu } from './events/index.js'
|
|
|
|
function onControlMounted(controlWindow) {
|
|
ipcMain.on('language-change', (event, data) => {
|
|
controlWindow.webContents.send('language-change', data)
|
|
})
|
|
|
|
ipcMain.on('theme-change', (event, data) => {
|
|
controlWindow.webContents.send('theme-change', data)
|
|
})
|
|
|
|
menu(controlWindow)
|
|
}
|
|
|
|
export default (mainWindow) => {
|
|
let controlWindow
|
|
|
|
ipcMain.handle('open-control-window', (event, data) => {
|
|
controlWindow = BrowserWindow.getAllWindows().find(
|
|
win => win.customId === 'control',
|
|
)
|
|
|
|
if (controlWindow) {
|
|
openControlWindow(controlWindow, data)
|
|
return false
|
|
}
|
|
|
|
controlWindow = initControlWindow(mainWindow)
|
|
|
|
ipcMain.on('control-mounted', () => {
|
|
openControlWindow(controlWindow, data)
|
|
onControlMounted(controlWindow)
|
|
})
|
|
})
|
|
}
|