// noinspection JSUnresolvedVariable require('./SDK/Entrypoint'); // This part is supposed to be require-d by the system // ---------------------- let initialized = false; global._STRAWBERRY_SYSTEMSOFTWARE_INIT = () => { Strawberry.App = "System Software"; Strawberry.System = true; Strawberry.Menus = [ "Power Off", "Restart", "System Info", "Debugger" ] Strawberry.StartLoad(initialized); Strawberry.WhenLoaded = () => { load("Strawberry.Audio"); load("Strawberry.MenuBar"); load("Strawberry.DisplayRaw"); load("Strawberry.SystemInfo"); load("Strawberry.Dialog"); load("Strawberry.AppManager"); Strawberry.MenuAction[0] = () => { Strawberry.Tick.Events = []; Strawberry.ProcessKeyboard = false; console.clear(); if (Strawberry.System) { let horizontal = Math.round(process.stdout.columns / 2 - (1 + (Strawberry.App.length / 2))); process.stdout.write(color.bgBlue.white(" ".repeat(horizontal + Strawberry.App.length) + " ".repeat(process.stdout.columns - horizontal - Strawberry.App.length))); } else { let horizontal = Math.round(process.stdout.columns / 2 - (1 + (Strawberry.App.length / 2))); process.stdout.write(color.bgBlue.white(" ".repeat(horizontal) + Strawberry.App + " ".repeat(process.stdout.columns - horizontal - Strawberry.App.length))); } setTimeout(() => { console.clear(); process.stdout.cursorTo(0, 0); setTimeout(() => { Strawberry.Dialog.Basic("It is now safe to turn off your computer.", "red"); }, 3000) }, 1000) } Strawberry.MenuAction[1] = () => { Strawberry.Tick.Events = []; Strawberry.ProcessKeyboard = false; console.clear(); if (Strawberry.System) { let horizontal = Math.round(process.stdout.columns / 2 - (1 + (Strawberry.App.length / 2))); process.stdout.write(color.bgBlue.white(" ".repeat(horizontal + Strawberry.App.length) + " ".repeat(process.stdout.columns - horizontal - Strawberry.App.length))); } else { let horizontal = Math.round(process.stdout.columns / 2 - (1 + (Strawberry.App.length / 2))); process.stdout.write(color.bgBlue.white(" ".repeat(horizontal) + Strawberry.App + " ".repeat(process.stdout.columns - horizontal - Strawberry.App.length))); } setTimeout(() => { console.clear(); process.stdout.cursorTo(0, 0); setTimeout(() => { require('child_process').spawnSync(process.argv[0], process.argv.filter((_, i) => { return i > 0 }), { stdio: "inherit" }); }, 3000) }, 1000) } Strawberry.MenuAction[3] = () => { setTimeout(() => { Strawberry.AppManager.Start(global._STRAWBERRY_SYSTEM_ROOT + "/Applications/Debugger.app"); }, 200) } Strawberry.DisplayRaw.Write(color.bold.underline("Strawberry OS " + Strawberry.SystemInfo.Version()), 5, 3) Strawberry.DisplayRaw.Write(Math.round(Strawberry.SystemInfo.GetHardwareMemory().Total / 1024) + "K memory", 5, 4) Strawberry.DisplayRaw.Write(Strawberry.SystemInfo.GetProcessors().Count + " processors", 5, 5) Strawberry.DisplayRaw.Write(color.bold.underline("Processes:"), 5, 7) let proc = Strawberry.SystemInfo.Processes().filter((i) => { return !i.includes("/node_modules/"); }).filter((_, i) => { let line = 8 + i; return line < process.stdout.rows - 2 }); let index = 0; for (let p of proc) { Strawberry.DisplayRaw.Write(p, 5, 8 + index); index++; } } initialized = true; } global._STRAWBERRY_SYSTEMSOFTWARE_INIT(); require("./CrashHandler");