Find the answer to your Linux question:
Results 1 to 5 of 5
I think I remember reading samewhere that any Linux program with a GUI actually just takes the input from your mouse and translates it to text commands, and then invisibly ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jan 2013
    Location
    Upstate New York
    Posts
    12

    Is there a "terminal monitor" I can install?


    I think I remember reading samewhere that any Linux program with a GUI actually just takes the input from your mouse and translates it to text commands, and then invisibly passes those commands to the terminal.

    Are there any widgets or anything that can let you watch what commands are being sent?

    For instance, if I use the graphical file manager to move example.txt to its parent directory, the terminal monitor would show "mv example.txt .."

    Then, if I did not know what "mv" did, I would be able to figure it out and learn more terminal commands just by watching what came up as I did stuff in the GUI.

    Does such a thing exist, or is it even possible?

  2. #2
    Linux Engineer hazel's Avatar
    Join Date
    May 2004
    Location
    Harrow, UK
    Posts
    1,167
    No, that isn't quite how it's done. A graphical program uses events to trigger handler functions. The events are first picked up by the X-server, and the earliest graphical apps that came with XFree86 used these directly. Modern widget libraries like gtk and qt wrap them up for use in a more programmer-friendly way. Mouse clicks are among these events.

    Every widget library has a function for binding an event to a handler. The handler is a function that you write to do something whenever the event occurs. It could be something completely internal, or it could launch another process - for example a shell script. If you wanted the handler to move something to another directory, I think a shell process running mv, as in your example, would probably be the simplest way. But in general mouse clicks are not translated into text; they're translated into C code.
    "I'm just a little old lady; don't try to dazzle me with jargon!"

  3. #3
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    11,158
    What hazel said. Your information is totally incorrect. When running the the X-Server GUI, you are not necessarily running in a "terminal" - all I/O is going directly to the GUI application. That said, if you are running a mouse-enabled text application that is using curses/ncurses (text-based UI), then that may be the case, but there are not a lot of those applications around these days, although there are still a few (can't think of what they are)...
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  4. #4
    Penguin of trust elija's Avatar
    Join Date
    Jul 2004
    Location
    Either at home or at work or down the pub
    Posts
    3,287
    midnight commander is one (much loved) example of an ncurses program that is still very much about.

    I suppose you could write a GUI to translate clicks to terminal commands but I can't see it being terribly efficient.
    What do we want?
    Time machines!

    When do we want 'em?
    Doesn't really matter does it!?


    Conkybots: Interactive plugins for your Conkys!

  5. #5
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    11,158
    I have written text-based (ncurses) programs in the past, much like Midnight Commander, that could use the mouse, and the code that handled the mouse input vector and click data would translate that into ncurses cursor movement or keyboard (Enter, Esc, etc) commands, or even terminal-accessible escape sequences, as necessary. So, it was in effect turning the mouse data into text (keyboard) input. However, that is a special case. I remember some console drivers that would do much the same so you could use the mouse in a purely text-based interface, but they are not commonly used any longer.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •