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, childCount, closeAreaWidth, showAddButton, showTabBar, tabHeight, tabPosition
propertyInherited Properties from Container: autoRelayout, childCount, layout, padding
propertyInherited Properties from Widget: accentColor, acceptFileDrops, backgroundColor, borderColor, bottom, canFocus, cornerRadius, cursor, font, foregroundColor, hasFocus, height, isEnabled, isHovered, isManaged, isPressed, isTabStop, isVisible, layoutParams, margin, maxHeight, maxWidth, minHeight, minWidth, parent, preferredHeight, preferredWidth, resolvedStyleCache, resolvedStyleCacheAppearanceMode, resolvedStyleCacheFont, resolvedStyleCacheRevision, resolvedStyleCacheStateKey, resolvedStyleCacheStyleClass, resolvedStyleCacheZoomRevision, right, size, sizePolicy, styleClass, toolTip, 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, tabClosed
eventInherited Events from Widget: filesDropped, focusGained, focusLost, 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 = 14)
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 = 14) 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, isCloseableAt, isModifiedAt, onTabClosed, onTabSelected, paint, select, setBounds, setModifiedAt, setTitleAt, titleAt, widgetAt
methodInherited Methods from Container: add, applyLayout, attachWindow, blur, children, clear, paintOverlay, remove, withLayout
methodInherited Methods from Widget: applyThemeMetrics, blur, containsPoint, emitFilesDropped, emitFocusGained, emitFocusLost, emitKeyPressed, emitKeyReleased, emitMouseMoved, emitMousePressed, emitMouseReleased, emitMouseWheel, handleTabKey, notifyPaintRequested, paint, paintClipped, paintForeground, paintOverlay, preferredSizeIncludesContentZoom, repaint, requestFocus, resolvePreferredHeight, resolvePreferredWidth, resolvedFont, setBounds
Inherited Operators
operatorInherited Operators from Container: operator[](index as Int) as Widget, operator[](index as UInt) as Widget