-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
56 lines (53 loc) · 1.79 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 electron = require('electron');
const app = electron.app;
const path = require('path');
const url = require('url');
const nativeImage = electron.nativeImage;
let demoIcon =nativeImage.createFromPath(path.join(__dirname, 'icon.png'))
const BrowserWindow = electron.BrowserWindow;
var mainWindow;
function createWindow(){
mainWindow = new BrowserWindow({width: 800, height: 800,/*backgroundColor: '#141414',*/transparent:true,minHeight: 800,minWidth: 800,icon:demoIcon,frame: false,webPreferences: {nodeIntegration: true}});
mainWindow.setMenuBarVisibility(false);
mainWindow.loadURL(url.format({
pathname: path.join(__dirname, 'quark.html'),
protocol: 'file:',
slashes: true
}));
//mainWindow.webContents.openDevTools();
mainWindow.on('closed',() => {
mainWindow = null;
});
};
var settingWindow = null;
exports.openwindowS = (filenameofthi)=>{
if(settingWindow === null){
settingWindow = new BrowserWindow({width: 800, height: 500,backgroundColor: '#141414',transparent:false,minHeight: 500,minWidth: 800,maxHeight: 500,maxWidth: 800,icon:demoIcon,frame: false,webPreferences: {nodeIntegration: true}});
settingWindow.setMenuBarVisibility(false);
settingWindow.loadURL(url.format({
pathname: path.join(__dirname, 'setting.html'+filenameofthi),
protocol: 'file:',
slashes: true
}));
settingWindow.webContents.openDevTools();
settingWindow.on('closed',() => {
settingWindow = null;
});
}
}
app.on('ready',createWindow);
app.on('window-all-closed', () => {
if (process.platform !== 'darwin'){
app.quit()
}
});
app.on('activate', () => {
if(mainWindow === null){
createWindow()
}
});
const {ipcMain} = require('electron')
ipcMain.on('resize-me-please', (event, arg) => {
mainWindow.setSize(800,800);
mainWindow.center();
})