You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

42 lines
1.0 KiB

1 year ago
const { app, BrowserWindow, screen } = require('electron')
1 year ago
const createWindow = () => {
1 year ago
const displays = screen.getAllDisplays()
const externalDisplay = displays.find((display) => {
return display.bounds.x !== 0 || display.bounds.y !== 0
})
// const mainWindow = new BrowserWindow({
// width: 800,
// height: 600,
// x: externalDisplay.bounds.x,
// y: externalDisplay.bounds.y
// })
// mainWindow.loadURL('https://example.com')
1 year ago
const win = new BrowserWindow({
1 year ago
frame: false, //隐藏头部操作栏
fullscreen: true, //是否全屏
1 year ago
x: externalDisplay.bounds.x + 50,
y: externalDisplay.bounds.y + 50
1 year ago
// icon: path.join(__dirname, '/bb.png'), //这里指定图标
})
win.loadURL('http://127.0.0.1:9000')
}
app.whenReady().then(() => {
createWindow()
app.on('activate', () => {
if (BrowserWindow.getAllWindows().length === 0) {
createWindow()
}
})
})
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit()
}
})