Downloading and building

Getting the DomTerm source code

The sources are in a GitHub repository. To download the sources do:

git clone https://github.com/PerBothner/DomTerm

Building from source

The core part of DomTerm is the JavaScript code terminal.js, which defines the DomTerm class. You can use terminal.js in your own application. However, there is also some utility code, include standalone terminal emulator applications.

The best terminal emulator experience at this time is probably the combination of libwebsockets 2.2 with the Electron front-end.

Another good application is qtdomterm. It uses the C++-based Qt toolkit including QtWebEngine. Needed packages are included with Fedora 24. (Reports of attempt to build or use qtdomterm on other platforms would be welcome.)

Building the sample applications and libraries is a two-part process:

If building from the git respository, first do:

autoreconf

This runs the GNU autotools (aclocal, autoconf, and automake).

Then run the configure script:

./configure configure-options

where configure-options can be:

--with-libwebsockets[=lws-build]

Build the C application ldomterm, which uses libwebsockets. If lws-build is specified, it should be the path to the build subdirectory of the libwebsockets compiled source tree. (The files lws-build/lib/libwebsockets.a and lws-build/include/libwebsockets.h should exist.)

While using libwebsockets version 2.2 or newer is strongly recommended. (Older versions do not support flow control or paging.)

On Fedora, you need to first:

sudo dnf install libwebsockets libwebsockets-devel json-c json-c-devel openssl-devel

This is the recommended “backend” and the default.

--with-java_websocket
--with-java_websocket=/path/to/java_websocket.jar

Build a WebSocket server, using Java WebSockets, which allows using any modern browser as a front-end. This server is no longer recommended or enabled by default.

This options adds the classes in java_websocket.jar to domterm.jar.

--enable-pty

Compile support for PTYs (pseudo-teletypes). This allows character mode: sending individual characters (rather than lines) from the front-end to the back-end. This is the default, except on Windows (which doesn’t support PTYs).

--with-javafx[=library-name]

Use JavaFX to run standalone applications. The library-name does not need to be specified if using Java SE 8. It may be needed for OpenJDK or Java SE 7, in which case it is either a path to jfxrt.jar, or (for convenience if using Java SE 7) the JAVA_HOME.

--without-java

Disable building anything that depends on Java.

--with-qtwebengine

Use Qt and QtWebEngine to build qtdomterm, an advanced front-end that supports multiple tabs, screen re-sizing, and other nice features.

For this you need the Qt development tools including QtWebEngine installed.

For Fedora, you also need:

sudo dnf install qt5-qtbase-devel  qt5-qtwebchannel-devel qt5-qtwebengine-devel
--with-closure-compiler=compiler.jar

Use Google Closure Compiler to minimize the size of the JavaScript. (Current only the “simple optimizations” are done. Using the “advanced optimizations” would reduce the JavaScript file siew further, but causes some not-yet-resolved problems.)

--enable-compiled-in-resources

This feature causes the html, JavaScript and css files needed by DomTerm to be compiled into the executable. Otherwise, they are served from the compressed domterm.jar.

--enable-ld-preload

This is an experimental feature to preload a library to interpose some system functions. Most importantly it overrides tcgetattr so that DomTerm gets notified on term terminal mode changes.

Then just:

make

To test it, you can try either:

bin/domterm

or

bin/qtdomterm

Either starts up a useable terminal emulator in a fresh window. The former starts up a bash shell, running in a PTY, with a libwebsockets server. It also starts a stripped-down browser window, using that for the input and output of the bash shell. The latter (obviously) runs qtdomterm.

The qtdomterm executable has no external dependencies (besides the Qt libraries), and you can copy to wherever you want it.