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 Details

    • type

      String type()
      Returns the terminal type identifier for this device.
      Returns:
      the terminal type (e.g., "xterm", "ansi", "vt100")
    • getBooleanCapability

      boolean getBooleanCapability(Capability capability)
      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

      Integer getNumericCapability(Capability capability)
      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

      String getStringCapability(Capability capability)
      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

      int[] getStringCapabilityAsInts(Capability capability, Object... params)
      Gets a string capability as an array of code points, with parameter substitution.
      Parameters:
      capability - the capability to retrieve
      params - 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

      boolean puts(Consumer<int[]> output, Capability capability, Object... params)
      Outputs a capability string to the given consumer with parameter substitution.
      Parameters:
      output - the consumer to receive the output as an int array
      capability - the capability to output
      params - optional parameters to substitute into the capability string
      Returns:
      true if the capability was found and output, false otherwise
    • puts

      boolean puts(Consumer<int[]> output, String capability, Object... params)
      Outputs a capability string to the given consumer with parameter substitution.
      Parameters:
      output - the consumer to receive the output as an int array
      capability - the capability name to look up and output
      params - 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

      default ColorDepth 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

      default ImageProtocol 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