use new Terminal Process in Terminal
This commit is contained in:
parent
ec89107262
commit
ec63a65ba3
@ -1,5 +1,6 @@
|
|||||||
package lib;
|
package lib;
|
||||||
|
|
||||||
|
import kernel.ps.Process;
|
||||||
import kernel.ps.ProcessManager;
|
import kernel.ps.ProcessManager;
|
||||||
import bin.KernelLog;
|
import bin.KernelLog;
|
||||||
import lib.ui.elements.UIElement;
|
import lib.ui.elements.UIElement;
|
||||||
@ -89,26 +90,8 @@ class HomeContext {
|
|||||||
focusContext(contextId);
|
focusContext(contextId);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function addTerminal(){
|
private function spawnPs(ps: Process) {
|
||||||
var newContext = WindowManager.instance.createNewBufferedContext();
|
var pid = ProcessManager.run(ps, {});
|
||||||
|
|
||||||
// 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(),{
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
var lastContextID = -1;
|
var lastContextID = -1;
|
||||||
|
|
||||||
for ( ctx in WindowManager.instance.getContextByPID(pid)){
|
for ( ctx in WindowManager.instance.getContextByPID(pid)){
|
||||||
@ -118,7 +101,7 @@ class HomeContext {
|
|||||||
if (lastContextID == -1) {
|
if (lastContextID == -1) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
focusContext(lastContextID);
|
focusContext(lastContextID);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function render() {
|
private function render() {
|
||||||
@ -132,8 +115,8 @@ class HomeContext {
|
|||||||
for (i in workspaceIDs) new TextElement('Switch to ${i + 1}', {onClick: this.handleSelectContext.bind(i)})
|
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 Terminal', {onClick: this.spawnPs.bind(new Terminal())}));
|
||||||
children.push(new TextElement('Add Log', {onClick: this.addLog}));
|
children.push(new TextElement('Add Log', {onClick: this.spawnPs.bind(new KernelLog())}));
|
||||||
children.push(new TextElement('Exit', {onClick: KernelEvents.instance.shutdown}));
|
children.push(new TextElement('Exit', {onClick: KernelEvents.instance.shutdown}));
|
||||||
|
|
||||||
renderer.setChildren(children);
|
renderer.setChildren(children);
|
||||||
|
Loading…
Reference in New Issue
Block a user