1

The standard xterm program has a Tek4014 emulation for some simple graphics output. This is however not implemented in most (all?) sucessors, like rxvt, gnome-terminal, or kterm.

However, almost all X11 terminals report xterm as (part of) the environment variable TERM, which makes it difficult for a program to determine whether the underlying terminal has graphics capabilities.

Is it possible to find that out programmatically? And, are there modern terminal windows (beside xterm) that implement Tek4014 graphics, maybe as an add-on?

olebole
  • 521
  • 4
  • 17

3 Answers3

1

Actually kterm provides Tek4014 emulation according to its menus. You are probably referring to KDE konsole, which does not. TeraTerm (a Windows application) reportedly also supports the feature.

Back to the point: there is no useful method for telling if a given terminal supports a given feature. Some terminals return status information which tells what type of terminal it is, and what optional features it may have (based on the device responses from DEC and similar terminals). The Tektronix terminal had no such status query/response (refer to XTerm Control Sequences).

Relying upon the status responses in any case doesn't give much assurance since some developers hard-code responses to match xterm.

Since the terminal will not tell you, the only way to verify that would be by actual inspection. Someone might construct a program that could do screendumps and verify that the terminal responds to the sequences, but there's still the pitfall that the switching between vt100(or similar) and tek4014 may not be done with the same escape sequence used in xterm. After all, that escape sequence is not in the standard repertoire of any hardware terminal.

Thomas Dickey
  • 51,086
  • 7
  • 70
  • 105
1

If you have access to the X11 display on which the terminal runs you can do the following. Output the "enter Tektronix mode" escape sequence "\E[?38h" and watch for a new window to open. The WM_CLIENT_LEADER property should probably be the ID of the original terminal window, and the WM_CLASS property should probably contain "tektronix" (I have only checked with the actual xterm application).

If you need to do this from your text-mode application, you can try checking whether a switch to the Tek window actually does something. For example,

echo -en '\n\E[?38h' && echo -en 12345678 && echo -en '\E\003' && \
    echo -en '\e[6n' && sleep 1 && echo -en '\n'

prints a newline, switches to the Tek window, prints some characters there, returns back to the VT window, and request the cursor position report. Since all the printing was in the Tek mode, the cursor should remain in column 1. However if the terminal doesn't support the Tek mode, the characters would be printed in the main window and the column would be >1.

n. m. could be an AI
  • 112,515
  • 14
  • 128
  • 243
0

The send device attributes sequence will cause the terminal to reply back with a cryptic string. Programs like vim use this to probe what version of xterm they are dealing with, but I don't know of specific documentation to interpret the results. Perhaps reading source?

See:

What is the ANSI escape code sequence "ESC[>c"?

Try it yourself:

 printf "\E[c\n" ; sleep 1 ; echo

My non-xterm xterm compatible terminal says "\E[?1;2c" back.

Cupcake Protocol
  • 661
  • 3
  • 10