TerminalWidget
classin packageklyn.gui.windows
public class TerminalWidget extends TabWidget:
└ TerminalWidget

Multi-tab terminal widget.

TerminalWidget hosts one or more TerminalView sessions in closable tabs. A leading + button opens a new terminal on the widget cwd, which follows the active terminal's current working directory when it is known.

terminal = TerminalWidget(cwd=Path.cwd.toString())
terminal.runCommand("klyn --version")
Properties
Modifier and Type Member Description
public readonly property activeTerminal
activeTerminal as TerminalView:
Active terminal session, or null when no tab is open.
public property command
command as String:
Shell command used by newly opened tabs.
public readonly property isRunning
isRunning as Boolean:
True when at least one terminal tab is still running.
public property singleTerminal
singleTerminal as Boolean:
When true, the widget exposes exactly one terminal and hides the tab bar.
Inherited Properties
propertyInherited Properties from TabWidget: activeIndex, activeTitle, activeWidget, addButtonWidth, closeAreaWidth, showAddButton, showTabBar, size, tabHeight
propertyInherited Properties from Container: autoRelayout, layout, padding
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 used for newly opened terminal tabs.
Events
Modifier and Type Member Description
public event terminated
terminated as ActionEvent
Emitted when the last terminal tab is closed or terminated.
Inherited Events
eventInherited Events from TabWidget: addTabRequested
eventInherited Events from Widget: keyPressed, keyReleased, mouseMoved, mousePressed, mouseReleased, mouseWheel, paintRequested, resized
Constructors
Modifier and Type Member Description
public TerminalWidget
TerminalWidget(command as String = "", cwd as String = "", terminalFont as String = "", fontSize as Int = 15):
Creates a terminal tab container and opens the first tab.
Methods
Modifier and Type Member Description
public applyFont
applyFont(terminalFont as String = "", fontSize as Int = 15) as Void:
Applies terminal font settings to all existing tabs and future tabs.
public close
close() as Void:
Closes every terminal tab and stops their pseudo-terminal processes.
public override onTabClosed
onTabClosed(widget as Widget) as Void:
No summary.
public override onTabSelected
onTabSelected(widget as Widget) as Void:
No summary.
public openTerminal
openTerminal(cwd as String = "") as TerminalView:
Opens a new terminal tab.
public runCommand
runCommand(command as String) as Void:
Runs a command in the active terminal, opening one when needed.
Inherited Methods
methodInherited Methods from TabWidget: addTab, applyLayout, closeTab, findTab, onTabClosed, onTabSelected, paint, select, setBounds, setTitleAt, titleAt, widgetAt
methodInherited Methods from Container: add, applyLayout, attachWindow, children, clear, paintOverlay, remove, withLayout
methodInherited Methods from Widget: blur, containsPoint, emitKeyPressed, emitKeyReleased, emitMouseMoved, emitMousePressed, emitMouseReleased, emitMouseWheel, handleTabKey, notifyPaintRequested, paint, paintOverlay, repaint, requestFocus, resolvePreferredHeight, resolvePreferredWidth, resolvedFont, setBounds
Inherited Operators
operatorInherited Operators from Container: operator[](index as Int) as Widget:, operator[](index as UInt) as Widget: