The dt-util script is going away.
All of its functionality will be folded into the domterm command.
The latter alread handles is-domterm
and html
.
The dt-util
command provides a number of useful features
when run in a DomTerm terminal.
For example you can print pictures, or change the background color.
The syntax is:
dt-utilsub-command
[option) ...
The sub-command
can be one described below.
help
[sub-help
]
Print some help. The sub-help
may be a sub-command.
is-domterm
Succeeds (exits with code 0) if the current terminal is DomTerm; fails (exits with code -1) otherwise.
This test does not depend on environment variables,
but instead sends a special request code, and checks the response.
This test works over an ssh
connection.
(The test does require that either DOMTERM
be non-empty,
or that TERM
be either empty or contain the string xterm
;
otherwise it does not try to the request code.)
html
html
html-value
...
Use this to embed HTML content info the DomTerm page. If there are no arguments, read from standard input. Either of the following work:
echo 'E = mc<sup>2</sup>' | dt-util html dt-util html 'E = mc<sup>2</sup>'
displays: E = mc2
.
image
[-n
] [--attrname
=attrvalue
]... filename
This script “prints” the contents of the named image file to domterm.
This uses a “data:
” URI with the file contents sent directly to domterm, so it works when working remotely.
The filename
must be a file that can be displayed
by an HTML <img>
element, most commonly a png
or jpg
file.
By default (no -n
is specified),
the image has a display: block
style
(so it is automatically on a “line” by itself),’
and gets a horizontal scroll bar if and only if it is too wide to fit.
If -n
is specified, then only a plain <img>
element is written,
which means you can write multiple images and other HTML on the same “line”.
--attrname
=attrvalue
Specify the given attribute; for example: --height=200
.
Valid attrnames
are the following, which
are specified in the HTML specification:
alt
, longdesc
, height
, width
, border
, hspace
, vspace
, class
.
For example: --width=600
scales the image width to be the given number
of pixels (in the CSS meaning). (The height is scaled proportionally,
unless you also specify the --height
option.)
fresh-line
If not already at beginning of line, starts a fresh line
reverse-video
on
|off
(The following currently require Java.)
add-style
style-rule
...
If called for the first time, create and install a temporary
stylesheet.
This temporary stylesheet has a name
attribute
with the value "(temporary-styles)"
.
Add each style-rule
to the temporary stylesheet.
For example, to change the background color to pink:
$ dt-util add-style "div.domterm { --background-color: pink }"
You can also set the background-color
style directly:
$ dt-util add-style "div.domterm { background-color: pink }"
Howeverm it is better to set the --background-color
CSS variable,
as that is required for reverse video and “Background Color Erase” to work.
Inverse video (using CSS variables):
$ dt-util add-style "div.domterm { --background-color: black; --foreground-color: white }"
Changing font size:
$ dt-util add-style "body { font-size: 14pt }"
list-stylesheets
List on the standard output the set of stylesheets associated with the domterm document, one per line:
$ dt-util list-stylesheets 0: enabled - "style/domterm-core.css" 1: enabled - "style/domterm-standard.css" 2: enabled "Default DomTerm styling" "style/domterm-default.css" 3: enabled - "(temporary-styles)"
After the sequence number, either enabled
or disabled
specified whether the stylesheet is disabled.
If the stylesheet has a title
, if is shown next (in json format);
otherwise -
is printed.
If the stylesheet has the href
attribute, it is shown next
(in json format);
otherwise, if it has the code
attribute, that is shown;
otherwise -
is printed.
load-stylesheet
name
filename
Replace or create a new stylesheet with the given name
.
The content of the stylesheet are read from the given filename
.
If the filename
is -
then standard input is used.
The name
is used to set the non-standard name
attribute
of the created <style>
element. If there is an existing stylesheet
with a matching name
attribute, then that stylesheet is replaced;
otherwise a new stylesheet is created.
The name
attribute is displayed by the list-stylesheets
subcommand.
print-stylesheet
index
Print out the style rules of the specified stylesheet,
which is an index
in the list-stylesheets
output.
disable-stylesheet
index
enable-stylesheet
index
Disable or enable the specified stylesheet.
A index
is an integer index into the
list as shown by list-stylesheets
.
$ dt-util disable-stylesheet 2