-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
39 lines (28 loc) · 940 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
const { app, BrowserWindow, screen } = require('electron');
const createWindow = () => {
const win = new BrowserWindow({
width: 250,
height: 250,
icon: __dirname + '/favicon.ico',
webPreferences: {
nodeIntegration: true
},
frame: false,
transparent: true,
resizable: false,
movable: true,
center: true,
});
win.loadFile('index.html');
win.on('will-move', (event, rectangle) => {
const { width, height } = screen.getPrimaryDisplay().workAreaSize;
rectangle.height + rectangle.y > height && event.preventDefault();
rectangle.width + rectangle.x > width && event.preventDefault();
// console.log({ y: rectangle.height + rectangle.y, wy: height });
// console.log({ x: rectangle.width + rectangle.x, wx: width });
})
return;
}
app.whenReady().then(() => {
createWindow()
})