/
githubmirror
/
edex-ui
Обзор
Документация
Войти
/
githubmirror
/
edex-ui
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
v0.6.0
src/_boot.js
89 строк
2 KB
GitSquared
Fix #29
31 дек 2017, 02:11
Не верифицирован
31 дек 2017, 02:11
c27eadd
Код
Авторство
О чём код?
const {app, BrowserWindow} = require("electron"); console.log(` =========================================================== Starting eDEX-UI v${app.getVersion()} with Node ${process.versions.node} on Electron ${process.versions.electron} =========================================================== `); const electron = require("electron"); const path = require("path"); const url = require("url"); const fs = require("fs"); const Terminal = require("./classes/terminal.class.js").Terminal; var win, tty; const settingsFile = path.join(electron.app.getPath("userData"), "settings.json"); if (!fs.existsSync(settingsFile)) { fs.writeFileSync(settingsFile, JSON.stringify({ shell: (process.platform === "win32") ? "powershell.exe" : "bash", keyboard: "en-US", cwd: electron.app.getPath("userData") })); } app.on('ready', () => { let settings = require(settingsFile); tty = new Terminal({ role: "server", shell: settings.shell, cwd: settings.cwd }); tty.onclosed = (code, signal) => { console.log("=> Terminal exited - "+code+", "+signal); app.quit(); }; tty.onopened = () => { console.log("=> Connected to front-end"); }; tty.onresized = (cols, rows) => { console.log("=> Resized terminal to "+cols+"x"+rows); }; tty.ondisconnected = () => { tty.tty.kill(); app.quit(); }; let {x, y, width, height} = electron.screen.getPrimaryDisplay().bounds; width++; height++; win = new BrowserWindow({ title: "eDEX-UI", x, y, width, height, show: false, resizable: true, movable: false, alwaysOnTop: true, fullscreen: true, // focusable: false, // skipTaskbar: true, autoHideMenuBar: true, frame: true, backgroundColor: '#000000' }); win.loadURL(url.format({ pathname: path.join(__dirname, 'ui.html'), protocol: 'file:', slashes: true })); win.once("ready-to-show", () => { win.show(); win.setResizable(false); }); }); app.on('window-all-closed', () => { app.quit(); }); app.on('before-quit', () => { console.log("=> Shutting down..."); });