-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.js
57 lines (46 loc) · 1.24 KB
/
main.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
const { app, BrowserWindow, globalShortcut } = require('electron')
let win;
function createWindow () {
win = new BrowserWindow({
width: 250,
height: 250,
// resizable:true,
alwaysOnTop: true,
maximizable:false,
frame: false,
transparent: true,
autoHideMenuBar: true,
icon: __dirname +'/rounded-cam-icon.ico',
webPreferences: {
nodeIntegration: true
}
});
//Always on top even in full screen apps (like powerpoint presentation)
win.setAlwaysOnTop(true, "screen-saver");
win.loadFile('src/index.html');
win.setAutoHideMenuBar(true);
// Emitted when the window is closed.
win.on('closed', function () {
// Dereference the window object, usually you would store windows
// in an array if your app supports multi windows, this is the time
// when you should delete the corresponding element.
mainWindow = null;
});
}
let big = false;
app.whenReady().then(() => {
globalShortcut.register('Alt+CommandOrControl+1', () => {
if (big) {
win.setSize(250,250);
big = false;
} else {
win.setSize(640,640);
big = true;
}
})
}).then(createWindow)
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit()
}
})