Class Tmux


  • public class Tmux
    extends java.lang.Object
    A terminal multiplexer similar to the 'tmux' Unix command.

    This class provides terminal multiplexing capabilities, allowing multiple virtual terminal sessions to be created, accessed, and controlled from a single terminal. Features include:

    • Window and pane management
    • Session persistence
    • Split screen layouts
    • Copy and paste functionality
    • Status line display
    • Command execution within panes

    The implementation provides a subset of the functionality of the Unix 'tmux' command, adapted for JLine's terminal handling and pure Java implementation.

    • Constructor Summary

      Constructors 
      Constructor Description
      Tmux​(Terminal terminal, java.io.PrintStream err, java.util.function.Consumer<Terminal> runner)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void bindKey​(java.io.PrintStream out, java.io.PrintStream err, java.util.List<java.lang.String> args)  
      protected void clockMode​(java.io.PrintStream out, java.io.PrintStream err, java.util.List<java.lang.String> args)  
      protected KeyMap<java.lang.Object> createEmptyKeyMap​(java.lang.String prefix)  
      protected KeyMap<java.lang.Object> createKeyMap​(java.lang.String prefix)  
      protected void displayPanes​(java.io.PrintStream out, java.io.PrintStream err, java.util.List<java.lang.String> args)  
      void execute​(java.io.PrintStream out, java.io.PrintStream err, java.lang.String command)  
      void execute​(java.io.PrintStream out, java.io.PrintStream err, java.util.List<java.lang.String> command)  
      protected void layoutResize()  
      protected void listKeys​(java.io.PrintStream out, java.io.PrintStream err, java.util.List<java.lang.String> args)  
      protected void listWindows​(java.io.PrintStream out, java.io.PrintStream err, java.util.List<java.lang.String> args)  
      protected void newWindow​(java.io.PrintStream out, java.io.PrintStream err, java.util.List<java.lang.String> args)  
      protected void nextWindow​(java.io.PrintStream out, java.io.PrintStream err, java.util.List<java.lang.String> args)  
      protected void previousWindow​(java.io.PrintStream out, java.io.PrintStream err, java.util.List<java.lang.String> args)  
      protected void redraw()
      Render all panes and the status line into the display and update the terminal screen.
      protected void resizePane​(java.io.PrintStream out, java.io.PrintStream err, java.util.List<java.lang.String> args)  
      void run()  
      protected void selectPane​(java.io.PrintStream out, java.io.PrintStream err, java.util.List<java.lang.String> args)  
      protected void sendKeys​(java.io.PrintStream out, java.io.PrintStream err, java.util.List<java.lang.String> args)  
      protected void sendPrefix​(java.io.PrintStream out, java.io.PrintStream err, java.util.List<java.lang.String> args)  
      protected void setOption​(java.io.PrintStream out, java.io.PrintStream err, java.util.List<java.lang.String> args)  
      protected void splitWindow​(java.io.PrintStream out, java.io.PrintStream err, java.util.List<java.lang.String> args)  
      protected void unbindKey​(java.io.PrintStream out, java.io.PrintStream err, java.util.List<java.lang.String> args)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Tmux

        public Tmux​(Terminal terminal,
                    java.io.PrintStream err,
                    java.util.function.Consumer<Terminal> runner)
             throws java.io.IOException
        Throws:
        java.io.IOException
    • Method Detail

      • createKeyMap

        protected KeyMap<java.lang.Object> createKeyMap​(java.lang.String prefix)
      • createEmptyKeyMap

        protected KeyMap<java.lang.Object> createEmptyKeyMap​(java.lang.String prefix)
      • run

        public void run()
                 throws java.io.IOException
        Throws:
        java.io.IOException
      • execute

        public void execute​(java.io.PrintStream out,
                            java.io.PrintStream err,
                            java.lang.String command)
                     throws java.lang.Exception
        Throws:
        java.lang.Exception
      • execute

        public void execute​(java.io.PrintStream out,
                            java.io.PrintStream err,
                            java.util.List<java.lang.String> command)
                     throws java.lang.Exception
        Throws:
        java.lang.Exception
      • listWindows

        protected void listWindows​(java.io.PrintStream out,
                                   java.io.PrintStream err,
                                   java.util.List<java.lang.String> args)
                            throws java.lang.Exception
        Throws:
        java.lang.Exception
      • previousWindow

        protected void previousWindow​(java.io.PrintStream out,
                                      java.io.PrintStream err,
                                      java.util.List<java.lang.String> args)
                               throws java.lang.Exception
        Throws:
        java.lang.Exception
      • nextWindow

        protected void nextWindow​(java.io.PrintStream out,
                                  java.io.PrintStream err,
                                  java.util.List<java.lang.String> args)
                           throws java.lang.Exception
        Throws:
        java.lang.Exception
      • newWindow

        protected void newWindow​(java.io.PrintStream out,
                                 java.io.PrintStream err,
                                 java.util.List<java.lang.String> args)
                          throws java.lang.Exception
        Throws:
        java.lang.Exception
      • setOption

        protected void setOption​(java.io.PrintStream out,
                                 java.io.PrintStream err,
                                 java.util.List<java.lang.String> args)
                          throws java.lang.Exception
        Throws:
        java.lang.Exception
      • bindKey

        protected void bindKey​(java.io.PrintStream out,
                               java.io.PrintStream err,
                               java.util.List<java.lang.String> args)
                        throws java.lang.Exception
        Throws:
        java.lang.Exception
      • unbindKey

        protected void unbindKey​(java.io.PrintStream out,
                                 java.io.PrintStream err,
                                 java.util.List<java.lang.String> args)
                          throws java.lang.Exception
        Throws:
        java.lang.Exception
      • listKeys

        protected void listKeys​(java.io.PrintStream out,
                                java.io.PrintStream err,
                                java.util.List<java.lang.String> args)
                         throws java.lang.Exception
        Throws:
        java.lang.Exception
      • sendKeys

        protected void sendKeys​(java.io.PrintStream out,
                                java.io.PrintStream err,
                                java.util.List<java.lang.String> args)
                         throws java.lang.Exception
        Throws:
        java.lang.Exception
      • clockMode

        protected void clockMode​(java.io.PrintStream out,
                                 java.io.PrintStream err,
                                 java.util.List<java.lang.String> args)
                          throws java.lang.Exception
        Throws:
        java.lang.Exception
      • displayPanes

        protected void displayPanes​(java.io.PrintStream out,
                                    java.io.PrintStream err,
                                    java.util.List<java.lang.String> args)
                             throws java.lang.Exception
        Throws:
        java.lang.Exception
      • resizePane

        protected void resizePane​(java.io.PrintStream out,
                                  java.io.PrintStream err,
                                  java.util.List<java.lang.String> args)
                           throws java.lang.Exception
        Throws:
        java.lang.Exception
      • selectPane

        protected void selectPane​(java.io.PrintStream out,
                                  java.io.PrintStream err,
                                  java.util.List<java.lang.String> args)
                           throws java.lang.Exception
        Throws:
        java.lang.Exception
      • sendPrefix

        protected void sendPrefix​(java.io.PrintStream out,
                                  java.io.PrintStream err,
                                  java.util.List<java.lang.String> args)
                           throws java.lang.Exception
        Throws:
        java.lang.Exception
      • splitWindow

        protected void splitWindow​(java.io.PrintStream out,
                                   java.io.PrintStream err,
                                   java.util.List<java.lang.String> args)
                            throws java.lang.Exception
        Throws:
        java.lang.Exception
      • layoutResize

        protected void layoutResize()
      • redraw

        protected void redraw()
        Render all panes and the status line into the display and update the terminal screen. Builds a composed screen from each pane's contents (or a clock string when a pane's clock mode is enabled), draws pane borders and optional pane identifiers, converts the composed buffer into attributed text lines, and submits them with the active cursor position to the Display for rendering.