-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
63 lines (55 loc) · 1.75 KB
/
app.js
File metadata and controls
63 lines (55 loc) · 1.75 KB
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
57
58
59
60
61
62
63
const electron = require("electron");
const ElectronConfig = require("electron-config");
const config = new ElectronConfig();
const url = require("url");
const path = require("path");
const dt = require("directory-tree");
const pug = require("electron-pug");
let mainWindow;
electron.app.on("ready", () => {
setTimeout(() => {
pug({ pretty: true })
.then(() => {
const woptions = {
show: false,
frame: false,
width: 800,
height: 600,
transparent: true,
resizeable: true
};
Object.assign(woptions, config.get("window"));
mainWindow = new electron.BrowserWindow(woptions);
mainWindow.loadURL(url.format({
pathname: path.join(__dirname, "views", "index.pug"),
protocol: "file:",
slashes: true
}));
mainWindow.on("close", () => {
config.set("window", mainWindow.getBounds());
});
mainWindow.on("closed", () => {
electron.app.quit();
});
mainWindow.once("ready-to-show", () => {
mainWindow.show();
if(process.env.TERM_PROGRAM == "vscode") {
mainWindow.webContents.openDevTools();
}
});
})
.catch(console.error);
}, 50);
});
electron.ipcMain.on("window:minimize", () => {
const window = electron.BrowserWindow.getFocusedWindow();
if(window.isMinimized()) {
window.restore();
return;
}
window.minimize();
});
// let i = 0;
// const root = dt(".", null, null, () => i++);
// console.log("Analyzed files: " + i);
// console.log(root);