Package org.aesh.terminal
Interface Device
- All Known Implementing Classes:
BaseDevice
public interface Device
Contains info and capabilities for the device we are connected to.
- Author:
- Ståle W. Pedersen
-
Method Summary
Modifier and TypeMethodDescriptionbooleangetBooleanCapability(Capability capability) Checks if this device has the specified boolean capability.default ColorDepthGet the color depth of this device based on terminfo capabilities.default ImageProtocolGet the image protocol supported by this device.getNumericCapability(Capability capability) Gets the value of a numeric capability.getStringCapability(Capability capability) Gets the value of a string capability.int[]getStringCapabilityAsInts(Capability capability, Object... params) Gets a string capability as an array of code points, with parameter substitution.default booleanCheck if this device is running inside a terminal multiplexer (like tmux or screen).booleanOutputs a capability string to the given consumer with parameter substitution.booleanputs(Consumer<int[]> output, Capability capability, Object... params) Outputs a capability string to the given consumer with parameter substitution.default booleanCheck if this device supports displaying images.default booleanCheck if this device supports OSC (Operating System Command) queries.type()Returns the terminal type identifier for this device.
-
Method Details
-
type
String type()Returns the terminal type identifier for this device.- Returns:
- the terminal type (e.g., "xterm", "ansi", "vt100")
-
getBooleanCapability
Checks if this device has the specified boolean capability.- Parameters:
capability- the capability to check- Returns:
- true if the capability is supported, false otherwise
-
getNumericCapability
Gets the value of a numeric capability.- Parameters:
capability- the capability to retrieve- Returns:
- the numeric value, or null if the capability is not set
-
getStringCapability
Gets the value of a string capability.- Parameters:
capability- the capability to retrieve- Returns:
- the string value, or null if the capability is not set
-
getStringCapabilityAsInts
Gets a string capability as an array of code points, with parameter substitution.- Parameters:
capability- the capability to retrieveparams- optional parameters to substitute into the capability string- Returns:
- the capability string as an int array of code points, or null if not set
-
puts
Outputs a capability string to the given consumer with parameter substitution.- Parameters:
output- the consumer to receive the output as an int arraycapability- the capability to outputparams- optional parameters to substitute into the capability string- Returns:
- true if the capability was found and output, false otherwise
-
puts
Outputs a capability string to the given consumer with parameter substitution.- Parameters:
output- the consumer to receive the output as an int arraycapability- the capability name to look up and outputparams- optional parameters to substitute into the capability string- Returns:
- true if the capability was found and output, false otherwise
-
supportsOscQueries
default boolean supportsOscQueries()Check if this device supports OSC (Operating System Command) queries.OSC queries like OSC 10/11 are used to query foreground/background colors. Not all terminals support these queries, and some terminal multiplexers (like tmux, screen) may intercept or block them.
- Returns:
- true if OSC queries are likely supported
-
getColorDepth
Get the color depth of this device based on terminfo capabilities.- Returns:
- the detected color depth, or null if not determinable from terminfo
-
isMultiplexer
default boolean isMultiplexer()Check if this device is running inside a terminal multiplexer (like tmux or screen).- Returns:
- true if running inside a multiplexer
-
supportsImages
default boolean supportsImages()Check if this device supports displaying images.- Returns:
- true if images can be displayed
-
getImageProtocol
Get the image protocol supported by this device.Detection is based on terminal type and environment variables. Supported protocols (in priority order):
- KITTY - Kitty, Ghostty, Konsole
- ITERM2 - iTerm2, WezTerm, Mintty, VSCode, Tabby, Hyper
- SIXEL - mlterm, foot, contour (fallback)
- Returns:
- the detected image protocol, or NONE if not supported
-