How some applications accept mouse click in bash over ssh?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
4
down vote

favorite
2












Applications like lynx browser, htop etc and many others accept position dependent mouse clicks in bash over ssh shell. I know that ssh is a command line interface. Then how does it accepts mouse clicks?







share|improve this question


























    up vote
    4
    down vote

    favorite
    2












    Applications like lynx browser, htop etc and many others accept position dependent mouse clicks in bash over ssh shell. I know that ssh is a command line interface. Then how does it accepts mouse clicks?







    share|improve this question
























      up vote
      4
      down vote

      favorite
      2









      up vote
      4
      down vote

      favorite
      2






      2





      Applications like lynx browser, htop etc and many others accept position dependent mouse clicks in bash over ssh shell. I know that ssh is a command line interface. Then how does it accepts mouse clicks?







      share|improve this question














      Applications like lynx browser, htop etc and many others accept position dependent mouse clicks in bash over ssh shell. I know that ssh is a command line interface. Then how does it accepts mouse clicks?









      share|improve this question













      share|improve this question




      share|improve this question








      edited Jan 22 at 21:36









      Jeff Schaller

      31.7k847108




      31.7k847108










      asked Jan 22 at 16:44









      Abhik Bose

      1,5341217




      1,5341217




















          2 Answers
          2






          active

          oldest

          votes

















          up vote
          5
          down vote



          accepted










          IMHO, the simplest way to write such a TUI application is to use ncurses.



          "New Curses" is a library that abstracts the design of the TUI from the details of the underlying device. All the software you cited use ncurses to render their interface.



          When you click on a terminal emulator (e.g. xterm, gnome-term, etc), the terminal emulator translates the click in a sequence of ANSI Escape codes. These sequences are read and translated in events by the ncurses library.



          You can find an example on Stack Overflow: Mouse movement events in NCurses






          share|improve this answer




















          • Great answer in a very interesting (at least for me) question!
            – k.Cyborg
            Jan 22 at 18:34

















          up vote
          3
          down vote













          It's pretty simple, in a old school serial terminal session, the mouse was not really an option for sending input to the interactive shell session. (I am sure there were some early exceptions.)



          However when you are running a terminal emulator inside a graphical desktop session the terminal emulator can be mouse aware.



          What happens on a high level is that the mouse events are translated by the terminal emulator (xterm for example) into terminal sequences and those are sent to the interactive shell session the application you are running, htop, vim whatever. In this case vim just sees the terminal sequence (like a simple series of keyboard events would produce), not the mouse event.






          share|improve this answer




















            Your Answer







            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "106"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            convertImagesToLinks: false,
            noModals: false,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );








             

            draft saved


            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f418901%2fhow-some-applications-accept-mouse-click-in-bash-over-ssh%23new-answer', 'question_page');

            );

            Post as a guest






























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            5
            down vote



            accepted










            IMHO, the simplest way to write such a TUI application is to use ncurses.



            "New Curses" is a library that abstracts the design of the TUI from the details of the underlying device. All the software you cited use ncurses to render their interface.



            When you click on a terminal emulator (e.g. xterm, gnome-term, etc), the terminal emulator translates the click in a sequence of ANSI Escape codes. These sequences are read and translated in events by the ncurses library.



            You can find an example on Stack Overflow: Mouse movement events in NCurses






            share|improve this answer




















            • Great answer in a very interesting (at least for me) question!
              – k.Cyborg
              Jan 22 at 18:34














            up vote
            5
            down vote



            accepted










            IMHO, the simplest way to write such a TUI application is to use ncurses.



            "New Curses" is a library that abstracts the design of the TUI from the details of the underlying device. All the software you cited use ncurses to render their interface.



            When you click on a terminal emulator (e.g. xterm, gnome-term, etc), the terminal emulator translates the click in a sequence of ANSI Escape codes. These sequences are read and translated in events by the ncurses library.



            You can find an example on Stack Overflow: Mouse movement events in NCurses






            share|improve this answer




















            • Great answer in a very interesting (at least for me) question!
              – k.Cyborg
              Jan 22 at 18:34












            up vote
            5
            down vote



            accepted







            up vote
            5
            down vote



            accepted






            IMHO, the simplest way to write such a TUI application is to use ncurses.



            "New Curses" is a library that abstracts the design of the TUI from the details of the underlying device. All the software you cited use ncurses to render their interface.



            When you click on a terminal emulator (e.g. xterm, gnome-term, etc), the terminal emulator translates the click in a sequence of ANSI Escape codes. These sequences are read and translated in events by the ncurses library.



            You can find an example on Stack Overflow: Mouse movement events in NCurses






            share|improve this answer












            IMHO, the simplest way to write such a TUI application is to use ncurses.



            "New Curses" is a library that abstracts the design of the TUI from the details of the underlying device. All the software you cited use ncurses to render their interface.



            When you click on a terminal emulator (e.g. xterm, gnome-term, etc), the terminal emulator translates the click in a sequence of ANSI Escape codes. These sequences are read and translated in events by the ncurses library.



            You can find an example on Stack Overflow: Mouse movement events in NCurses







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Jan 22 at 17:13









            andcoz

            11.7k32938




            11.7k32938











            • Great answer in a very interesting (at least for me) question!
              – k.Cyborg
              Jan 22 at 18:34
















            • Great answer in a very interesting (at least for me) question!
              – k.Cyborg
              Jan 22 at 18:34















            Great answer in a very interesting (at least for me) question!
            – k.Cyborg
            Jan 22 at 18:34




            Great answer in a very interesting (at least for me) question!
            – k.Cyborg
            Jan 22 at 18:34












            up vote
            3
            down vote













            It's pretty simple, in a old school serial terminal session, the mouse was not really an option for sending input to the interactive shell session. (I am sure there were some early exceptions.)



            However when you are running a terminal emulator inside a graphical desktop session the terminal emulator can be mouse aware.



            What happens on a high level is that the mouse events are translated by the terminal emulator (xterm for example) into terminal sequences and those are sent to the interactive shell session the application you are running, htop, vim whatever. In this case vim just sees the terminal sequence (like a simple series of keyboard events would produce), not the mouse event.






            share|improve this answer
























              up vote
              3
              down vote













              It's pretty simple, in a old school serial terminal session, the mouse was not really an option for sending input to the interactive shell session. (I am sure there were some early exceptions.)



              However when you are running a terminal emulator inside a graphical desktop session the terminal emulator can be mouse aware.



              What happens on a high level is that the mouse events are translated by the terminal emulator (xterm for example) into terminal sequences and those are sent to the interactive shell session the application you are running, htop, vim whatever. In this case vim just sees the terminal sequence (like a simple series of keyboard events would produce), not the mouse event.






              share|improve this answer






















                up vote
                3
                down vote










                up vote
                3
                down vote









                It's pretty simple, in a old school serial terminal session, the mouse was not really an option for sending input to the interactive shell session. (I am sure there were some early exceptions.)



                However when you are running a terminal emulator inside a graphical desktop session the terminal emulator can be mouse aware.



                What happens on a high level is that the mouse events are translated by the terminal emulator (xterm for example) into terminal sequences and those are sent to the interactive shell session the application you are running, htop, vim whatever. In this case vim just sees the terminal sequence (like a simple series of keyboard events would produce), not the mouse event.






                share|improve this answer












                It's pretty simple, in a old school serial terminal session, the mouse was not really an option for sending input to the interactive shell session. (I am sure there were some early exceptions.)



                However when you are running a terminal emulator inside a graphical desktop session the terminal emulator can be mouse aware.



                What happens on a high level is that the mouse events are translated by the terminal emulator (xterm for example) into terminal sequences and those are sent to the interactive shell session the application you are running, htop, vim whatever. In this case vim just sees the terminal sequence (like a simple series of keyboard events would produce), not the mouse event.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Jan 22 at 17:00









                datUser

                2,2811032




                2,2811032






















                     

                    draft saved


                    draft discarded


























                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f418901%2fhow-some-applications-accept-mouse-click-in-bash-over-ssh%23new-answer', 'question_page');

                    );

                    Post as a guest













































































                    Popular posts from this blog

                    How to check contact read email or not when send email to Individual?

                    Bahrain

                    Postfix configuration issue with fips on centos 7; mailgun relay