0

I think it would be awesome if we could render and also interact with html and javascript in a terminal. The idea is to render buttons and other interactive widgets like file trees in the command line, and being able to interact with them with the mouse. It doesn't necessarily have to be built on html/js, but those technologies seem to fit the purpose and are probably the most advanced.

The advantage to a regular browser is of course that everything is still based on the terminal, so you have full control of the underlying system and can run commands directly. I rather imagine using commands like tree . to show the current directory and subdirectories in an interactive tree widget you can expand with mouse clicks.

Are there any terminal emulators which support rendering of html pages and can run javascript?

2
  • Your question is not clear: are you looking for a terminal which display HTML or an mouse-interactive one? – mattia.b89 Nov 15 '19 at 12:12
  • @mattia.b89 Both. I know of terminal emulators which capture the mouse and I know of terminal applications which use that mouse input, but most terminals are entirely text based and do not support rendering of images or anything alike. I am looking for a way to display anything in a terminal environment, and I brought HTML up because it is a sophisticated technology and also interfaces with scripting languages. – stimulate Nov 15 '19 at 12:44
1

What you describe sounds a bit like a notebook, recently popular for interactive programming e.g. in Python. Jupyter Notebook supports quite a number of different kernels, and there are even two for bash, calysto_bash and bash_kernel.

The development of Jupyter Notebook started with IPython, an enhanced Python shell that runs in a standard terminal, but in the modern form the rendering of the notebook is based on web technologies. It usually runs through a browser, but there is also a standalone console.

However, in order for this to do what you want, command line programs would have to produce output in a format that can be interpreted by the kernel, which in turn sends it in a special JSON format to the notebook renderer.

As far as I can tell, bash_kernel supports only image display, through a special bash function display (see here for a demonstration). But it would certainly be possible to extend these capabilities to other forms of "Rich Output".

2

Following the KISS logic that is beloved in Linux and UNIX world, a terminal emulator is a terminal emulator, no more.

You mix several things:

  • You want command line program to implement point and click logic... there's already that kind of commands in Linux. For example, Midnight commander is a text-based file manager based on ncurses. Note that (thanks god) there's no need of HTML/JS to have some eye-candy in shell.

  • If you really want to browse web, then what you want is a command-line browser. There's several command line browser existing:

Nevertheless, my opinion is that the kind of features you are dreaming of are not really following the "spirit" of the command line. If you want to click, then use a GUI. Command line is mostly used for powerusers that do not want to waste time by using mouse and clicking...

9
  • 2
    In between CLI and GUI there is the TUI which often accept clicks in addition to arrow/tab based navigation. Some of the most beloved software are TUI like mc (midnight commander) a mouse-enabled console file manager. Or slap and (my own) tcled - console text/code editors with mouse support. People who use the terminal don't necessarily shy away from the mouse – slebetman Nov 15 '19 at 11:02
  • Going off topic with this, but exactly your elitist attitude ("powerusers which dOnT wAnT tO wAsTe TiMe") is the reason for a lot of conflict in the industry. There are advantages to a command line and there are advantages to a gui. I use the command line almost exclusively during development, so I understand it's benefits. But sometimes it would be useful to use the mouse to navigate file trees quickly, or view images, or expand and collapse text nodes, or click links to files or open files by clicking etc. – stimulate Nov 15 '19 at 11:32
  • 2
    This is not "elitism", just using the good tool for purpose. I guess that, today, Most of Linux/BSD users run a graphical session (it's my case). When i need to browse files, i launch nautilus. When i need to script something, i use command line. Your example for editing is ok... but I could argue that it takes more time to locate a file using nautilus than find in command line. There's no absolut truth regarding this topic, but habits and opinons. But i think i'm not THAT wrong when i tell that most people who use command line don't really need a mouse :) – binarym Nov 15 '19 at 12:43
  • 2
    Now, the real power of Open Source systems is the freedom to do what you want. If you feel that your need maybe other peoples need, then feel free to develop or fork an existing terminal to implement your idea. Maybe, when i'll test it, it will convince me and i'll become addict to it ... who knows ? ;-) – binarym Nov 15 '19 at 12:44
  • 2
    As a developer of a terminal, I couldn't agree more with binarym's answer. It's not elitits at all, it shows you the current design. There is probably no way the current mechanisms supported by a terminal emulator (e.g. moving the cursor to arbitrary character cells) could be supported along with html rendering. The terminal would be a terrible place to even attempt to do this. There are terminal-based applications which let you browse the web as much as it's possible within the terminal's limitations. You can use them. Or you can just use a graphical browser, the best tool for the given task. – egmont Nov 15 '19 at 14:09
1

Although it does not render html, kitty seems to be going into a similar direction of combining command lines with graphical interfaces. For example, icat can print images to the terminal.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.