Class MouseTracking

java.lang.Object
org.aesh.terminal.tty.MouseTracking

public final class MouseTracking extends Object
Controls mouse tracking on the terminal.

Mouse tracking is enabled by sending DEC private mode sequences to the terminal. The protocol controls which events are reported, and the encoding controls how coordinates are transmitted.

Example usage:

// Enable normal tracking with SGR encoding
MouseTracking.enable(connection, MouseTracking.Protocol.NORMAL);
MouseTracking.enableEncoding(connection, MouseTracking.Encoding.SGR);

// ... handle mouse events ...

// Disable on cleanup
MouseTracking.disable(connection, MouseTracking.Protocol.NORMAL);
MouseTracking.disableEncoding(connection, MouseTracking.Encoding.SGR);
See Also:
  • Method Details

    • enable

      public static void enable(Appendable out, MouseTracking.Protocol protocol) throws IOException
      Enables a mouse tracking protocol.
      Parameters:
      out - the output to write the escape sequence to
      protocol - the protocol to enable
      Throws:
      IOException - if writing fails
    • disable

      public static void disable(Appendable out, MouseTracking.Protocol protocol) throws IOException
      Disables a mouse tracking protocol.
      Parameters:
      out - the output to write the escape sequence to
      protocol - the protocol to disable
      Throws:
      IOException - if writing fails
    • enableEncoding

      public static void enableEncoding(Appendable out, MouseTracking.Encoding encoding) throws IOException
      Enables a mouse coordinate encoding.
      Parameters:
      out - the output to write the escape sequence to
      encoding - the encoding to enable
      Throws:
      IOException - if writing fails
    • disableEncoding

      public static void disableEncoding(Appendable out, MouseTracking.Encoding encoding) throws IOException
      Disables a mouse coordinate encoding.
      Parameters:
      out - the output to write the escape sequence to
      encoding - the encoding to disable
      Throws:
      IOException - if writing fails