Skip to content
This repository was archived by the owner on Oct 22, 2021. It is now read-only.

Commit f85334c

Browse files
committed
✨ Add --nointro setting option and cli flag - #315
1 parent 5069123 commit f85334c

File tree

2 files changed

+44
-27
lines changed

2 files changed

+44
-27
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
],
1414
"main": "src/_boot.js",
1515
"scripts": {
16-
"start": "node_modules/.bin/electron src",
16+
"start": "node_modules/.bin/electron src --nointro",
1717
"install-linux": "npm install && cd src && npm install && ./../node_modules/.bin/electron-rebuild -f -w node-pty && cd ..",
1818
"preinstall-windows": "npm install --global --production windows-build-tools && npm install --global node-gyp && setx PYTHON \"%USERPROFILE%\\.windows-build-tools\\python27\\python.exe\"",
1919
"install-windows": "npm install && cd src && npm install && ..\\node_modules\\.bin\\electron-rebuild -f -w node-pty && cd ..",

src/_renderer.js

Lines changed: 43 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,13 @@ const settingsFile = path.join(settingsDir, "settings.json");
3636
// Load config
3737
window.settings = require(settingsFile);
3838

39+
// Load CLI parameters
40+
if (electron.remote.process.argv.includes("--nointro")) {
41+
window.settings.nointro = true;
42+
} else {
43+
window.settings.nointro = false;
44+
}
45+
3946
// Load UI theme
4047
window._loadTheme = (theme) => {
4148

@@ -83,14 +90,35 @@ window._loadTheme = (theme) => {
8390

8491
_loadTheme(require(path.join(themesDir, settings.theme+".json")));
8592

86-
// Startup boot log
87-
let resumeInit, initUI, initMods, initGreeter;
88-
let bootScreen = document.getElementById("boot_screen");
89-
let log = fs.readFileSync(path.join(__dirname, 'assets/misc/boot_log.txt')).toString().split('\n');
90-
let i = 0;
91-
displayLine();
93+
function initGraphicalErrorHandling() {
94+
window.edexErrorsModals = [];
95+
window.onerror = (msg, path, line, col, error) => {
96+
let errorModal = new Modal({
97+
type: "error",
98+
title: error,
99+
message: `${msg}<br/> at ${path} ${line}:${col}`
100+
});
101+
window.edexErrorsModals.push(errorModal);
92102

103+
ipc.send("log", "error", `${error}: ${msg}`);
104+
ipc.send("log", "debug", `at ${path} ${line}:${col}`);
105+
};
106+
}
107+
108+
if (!window.settings.nointro) {
109+
let i = 0;
110+
displayLine();
111+
} else {
112+
initGraphicalErrorHandling();
113+
document.getElementById("boot_screen").remove();
114+
initUI();
115+
}
116+
117+
// Startup boot log
93118
function displayLine() {
119+
let bootScreen = document.getElementById("boot_screen");
120+
let log = fs.readFileSync(path.join(__dirname, 'assets/misc/boot_log.txt')).toString().split('\n');
121+
94122
function isArchUser() {
95123
return require("os").platform() === "linux"
96124
&& fs.existsSync("/etc/os-release")
@@ -134,7 +162,7 @@ function displayLine() {
134162
}
135163

136164
// Show "logo" and background grid
137-
resumeInit = () => {
165+
function resumeInit() {
138166
bootScreen.innerHTML = "";
139167
setTimeout(() => {
140168
document.body.setAttribute("class", "");
@@ -155,28 +183,17 @@ resumeInit = () => {
155183
title.setAttribute("style", `border: 5px solid rgb(${window.theme.r}, ${window.theme.g}, ${window.theme.b});`);
156184
setTimeout(() => {
157185
// Initiate graphical error display
158-
window.edexErrorsModals = [];
159-
window.onerror = (msg, path, line, col, error) => {
160-
let errorModal = new Modal({
161-
type: "error",
162-
title: error,
163-
message: `${msg}<br/> at ${path} ${line}:${col}`
164-
});
165-
window.edexErrorsModals.push(errorModal);
166-
167-
ipc.send("log", "error", `${error}: ${msg}`);
168-
ipc.send("log", "debug", `at ${path} ${line}:${col}`);
169-
};
186+
initGraphicalErrorHandling();
170187
document.getElementById("boot_screen").remove();
171188
initUI();
172189
}, 1200);
173190
}, 600);
174191
}, 300);
175192
}, 400);
176-
};
193+
}
177194

178195
// Create the UI's html structure and initialize the terminal client and the keyboard
179-
initUI = () => {
196+
function initUI() {
180197
document.body.innerHTML += `<section class="mod_column" id="mod_column_left">
181198
<h3 class="title"><p>PANEL</p><p>SYSTEM</p></h3>
182199
</section>
@@ -223,10 +240,10 @@ initUI = () => {
223240
}, 700);
224241
}, 500);
225242
}, 10);
226-
};
243+
}
227244

228245
// Create the "mods" in each column
229-
initMods = () => {
246+
function initMods() {
230247
window.mods = {};
231248

232249
// Left column
@@ -263,9 +280,9 @@ initMods = () => {
263280
i++;
264281
}
265282
}, 500);
266-
};
283+
}
267284

268-
initGreeter = () => {
285+
function initGreeter() {
269286
let shellContainer = document.getElementById("main_shell");
270287
let greeter = document.getElementById("main_shell_greeting");
271288

@@ -326,7 +343,7 @@ initGreeter = () => {
326343
}, 500);
327344
}, 1100);
328345
});
329-
};
346+
}
330347

331348
window.themeChanger = (theme) => {
332349
for (let i = 1; i <= 4; i++) {

0 commit comments

Comments
 (0)