In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces how to use DomTerm in linux, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand it.
DomTerm is a modern terminal emulator that uses a browser engine as a "GUI toolkit". This supports some related features, such as embeddable images and links, HTML rich text, and collapsible (show / hide) commands. In addition, it looks like a fully functional, stand-alone terminal emulator with excellent xterm compatibility (including mouse processing and 24-bit colors) and proper "decoration" (menu). In addition, it has built-in support for session management and secondary windows (as in tmux and GNU Screen), basic input editing (such as in readline), and paging (such as in less).
Figure 1: DomTerminal terminal simulator.
We will take a look at these features in the following sections. We will assume that you have installed domterm. Before we begin, let's take a quick look at this technology.
Front-end vs. Back end
DomTerm is mostly written in JavaScript and runs in a browser engine. It can be a desktop browser such as Chrome or Firefox (see figure 3), or it can be an embedded browser. There is no problem with using a general-purpose web browser, but the user experience is not good enough (because menus are built for general-purpose web browsing, not for terminal emulators), and its security model can hinder use. So it's better to use an embedded browser.
The following are currently supported:
Qdomterm, using the Qt toolkit and QtWebEngine
An embedded Electron (see figure 1)
Atom-domterm runs DomTerm as an Atom text editor (also based on Electron) package and integrates with the Atom panel system (see figure 2)
A WebEngine wrapper for JavaFX, which is very useful for Java programming (see figure 4)
The front end used Firefox-XUL before, but Mozilla has terminated XUL
Figure 2: DomTerm terminal panel in the Atom editor.
At present, the Electron front end may be the better choice, followed by the Qt front end. If you use Atom,atom-domterm, you also work pretty well.
The back-end server is written in C. It manages pseudo terminals (PTY) and sessions. It is also a HTTP server that provides Javascript and other files for the front end. The domterm command starts terminal tasks and executes other requests. If there is no server running, domterm will serve itself. Communication between the back end and the server is usually done using WebSockets (libwebsockets on the server side). However, JavaFX embedding uses neither a Websockets nor a DomTerm server. Instead, Java applications communicate directly through Java-Javascript bridging.
A robust xterm compatible terminal simulator
DomTerm looks and feels like a modern terminal emulator. It handles mouse events, 24-bit colors, Unicode, double width characters (CJK), and input methods. DomTerm works very well on the vttest test suite.
Its unusual features include:
Show / hide button ("fold"): the small triangle (figure 2 above) is the button to hide / show the corresponding output. You can create a button simply by adding specific escape characters to the prompt.
Mouse click support for readline and similar input editors: if you click on the input area, DomTerm will send the correct sequence of directional keys to the application. (you can enable this feature through the escape characters in the prompt, or you can force it with the Alt+ click. )
Styling the terminal with CSS: this is usually done in ~ / .domterm/settings.ini and will be automatically reloaded when saved. For example, in figure 2, the background color specific to the terminal is set.
A better REPL console
A classic terminal simulator works based on rectangular character cells. This is fine on the REPL (command line), but not ideal. Here are some useful DomTerm features of REPL that are not common in terminal emulators:
A command that can "print" pictures, graphics, mathematical formulas, or a set of clickable links: applications can send escape characters that contain almost any HTML. (HTML will be removed to remove JavaScript and other hazardous features. )
Figure 3 shows a fragment from a gnuplot session. Gnuplot (version 2.1 or later) supports DormTerm as a terminal type. The graphic output is converted into a SVG picture and then printed to the terminal. My blog post on the Gnuplot presentation on DormTerm provides more information in this regard.
Picture 3:Gnuplot screenshot.
The Kawa language has a library for creating and converting geometric image values. If you print such a picture value to a DomTerm terminal, the picture will be converted to SVG and embedded in the output.
The calculable geometry in figure 4:Kawa.
Rich text output: HTML-style help messages are easier to read and look more beautiful. The panel below in figure 1 shows the output of dormterm help. (plain text is output if it is not running under DomTerm. Pay attention to the PAUSED messages in the built-in pager
Error messages that include clickable links: DomTerm recognizes the syntax filename:line:column and converts it into a link that opens the file in a customizable text editor and navigates to the line. (this applies to relative path filenames if you use PROMPT_COMMAND or similar trace directories. )
The compiler can detect that it is running under DomTerm and issue file links directly with escape characters. This is much more robust than relying on DomTerm style matching because it can handle spaces and other characters and does not have to rely on directory tracking. In figure 4, you can see the error message from Kawa Compiler. Hovering over the file location causes it to be underlined, and file: URL appears in the atom-domterm message bar (bottom of the window). (when atom-domterm is not used, such a message is displayed in a floating box, as shown in the PAUSED message seen in figure 1. )
The action when you click on the link is configurable. The default is for file with the # position suffix: the action of the link is to open that file in a text editor.
Structured internal representation: the following are represented by internal node structures: commands, prompts, input lines, normal and error outputs, labels, and if "Save as HTML", the structure is preserved. HTML files are compatible with XML, so you can use the XML tool to search or convert the output. The command domterm view-saved opens the saved HTML file in a way that enables command collapse (the Show / hide button is active) and resizes the window.
Built-in Lisp style graceful printing: you can include graceful print instructions (such as grouping) in the output so that line breaks are recalculated according to window resizing. Check out dynamic Beauty Printing in my article DomTerm for a more in-depth discussion.
Basic CCB editor with history (like GNU readline): this uses the editor that comes with the browser, so it has an excellent mouse and selection processing mechanism. You can switch between normal character mode (most entered characters are referred to as being fed to the process), or line mode (usually the characters are inserted directly, while the control characters cause editing, and the enter key sends the edited lines to the process). The default is automatic mode, and DomTerm converts between character mode and line mode, depending on whether PTY is in original mode or terminal mode.
Built-in pager (similar to the simplified version of less): keyboard shortcuts control scrolling. In "page mode", the output is paused after each new screen (or individual lines, if you want to move forward line by line); page mode is simple for user input, so (if you want) you can run it without hindering the interactive program.
Multiplexing and session
Tags and tiling: you can not only create multiple terminal tags, but also tile them. You can either use mouse or keyboard shortcuts to create or switch panels and tabs. They can be rearranged and resized with the mouse. This is done through the GoldenLayout JavaScript library. Figure 1 shows a window with two panels. There are two tags above, and a panel running under Midnight Commander; shows the dormterm help output in HTML form. Instead, in Atom, we use its own draggable panels and tags. You can see this in figure 2.
Detach or reconnect sessions: similar to tmux and GNU screen, DomTerm supports session scheduling. You can even connect multiple windows or panels to the same session. This supports multi-user session sharing and remote links. For security, all sessions on the same server need to be able to read the Unix domain interface and a local file that contains a random key. When we have good, secure remote links, this restriction will be relaxed. )
The domterm command, similar to tmux and GNU screen, has several options for controlling or opening a server for single or multiple sessions. The main difference is that if it is not running under DomTerm, the dormterm command creates a new top-level window instead of running in an existing terminal.
Like tmux and git, the dormterm command has many subcommands. A few subcommands create a window or session. Others (such as "printing" a picture) work only under existing DormTerm sessions.
Command domterm browse to open a window or panel to browse a specified URL, such as when browsing a document.
Thank you for reading this article carefully. I hope the article "how to use DomTerm in linux" shared by the editor will be helpful to everyone. At the same time, I also hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.