use new Terminal Process in Terminal

This commit is contained in:
Djeeberjr 2023-05-22 22:26:00 +02:00
parent ec89107262
commit ec63a65ba3

View File

@ -1,5 +1,6 @@
package lib;
import kernel.ps.Process;
import kernel.ps.ProcessManager;
import bin.KernelLog;
import lib.ui.elements.UIElement;
@ -89,26 +90,8 @@ class HomeContext {
focusContext(contextId);
}
private function addTerminal(){
var newContext = WindowManager.instance.createNewBufferedContext();
// Create new terminal
var term = new Terminal();
term.invoke(newContext);
var contextID = addContextNextWorkspace(newContext);
if (contextID == -1) {
return;
}
focusContext(contextID);
}
private function addLog(){
var pid = ProcessManager.run(new KernelLog(),{
});
private function spawnPs(ps: Process) {
var pid = ProcessManager.run(ps, {});
var lastContextID = -1;
for ( ctx in WindowManager.instance.getContextByPID(pid)){
@ -132,8 +115,8 @@ class HomeContext {
for (i in workspaceIDs) new TextElement('Switch to ${i + 1}', {onClick: this.handleSelectContext.bind(i)})
];
children.push(new TextElement('Add Terminal', {onClick: this.addTerminal}));
children.push(new TextElement('Add Log', {onClick: this.addLog}));
children.push(new TextElement('Add Terminal', {onClick: this.spawnPs.bind(new Terminal())}));
children.push(new TextElement('Add Log', {onClick: this.spawnPs.bind(new KernelLog())}));
children.push(new TextElement('Exit', {onClick: KernelEvents.instance.shutdown}));
renderer.setChildren(children);