TerminalView
classin packageklyn.gui.windows
public class TerminalView extends Canvas:
└ Canvas
└ TerminalView

Reusable interactive terminal widget backed by PseudoTerminal.

TerminalView is intentionally part of the GUI library, not the editor tool, so applications can embed a real shell-like terminal with keyboard input, ANSI line editing, scrolling and process lifecycle notification.

terminal = TerminalView()
terminal.terminated += lambda(e: ActionEvent): print("shell closed")
terminal.runCommand("pwd")
Properties
Modifier and Type Member Description
public readonly property isRunning
isRunning as Boolean:
True while the backing pseudo-terminal process is still running.
public readonly property workingDirectory
workingDirectory as String:
Current working directory of the underlying shell.
Inherited Properties
propertyInherited Properties from Widget: accentColor, backgroundColor, borderColor, bottom, canFocus, cornerRadius, font, foregroundColor, hasFocus, height, isEnabled, isHovered, isManaged, isTabStop, isVisible, layoutParams, margin, maxHeight, maxWidth, minHeight, minWidth, parent, preferredHeight, preferredWidth, right, sizePolicy, styleClass, width, window, x, y
Signals
Modifier and Type Member Description
public signal property cwd
cwd as String:
Current working directory tracked by the terminal.
Events
Modifier and Type Member Description
public event terminated
terminated as ActionEvent
Emitted when the underlying pseudo-terminal process exits.
Inherited Events
eventInherited Events from Widget: keyPressed, keyReleased, mouseMoved, mousePressed, mouseReleased, mouseWheel, paintRequested, resized
Constructors
Modifier and Type Member Description
public TerminalView
TerminalView(command as String = "", cwd as String = "", terminalFont as String = "", fontSize as Int = 15):
Creates and starts a terminal.
Methods
Modifier and Type Member Description
public append
append(line as String) as Void:
Appends text to the terminal display without writing to the shell.
public applyFont
applyFont(terminalFont as String = "", fontSize as Int = 15) as Void:
Updates the rendered font and recomputes the terminal geometry.
public close
close() as Void:
Stops polling and closes the underlying pseudo-terminal.
public override handleTabKey
handleTabKey(backward as Boolean) as Boolean:
Sends Tab or Shift+Tab to the terminal instead of moving focus.
public override paint
paint(painter as Painter) as Void:
No summary.
public runCommand
runCommand(command as String) as Void:
Writes a command followed by a newline to the pseudo-terminal.
Inherited Methods
methodInherited Methods from Widget: blur, containsPoint, emitKeyPressed, emitKeyReleased, emitMouseMoved, emitMousePressed, emitMouseReleased, emitMouseWheel, handleTabKey, notifyPaintRequested, paint, paintOverlay, repaint, requestFocus, resolvePreferredHeight, resolvePreferredWidth, resolvedFont, setBounds