M_xterm(3fm) - [M_xterm] send escape sequences to an xterm(1) window that control VT102 emulator attributes (LICENSE:MIT)
Synopsis
Description
Example
See Also
Author
License
Usage:
use M_xterm, only : xterm_font use M_xterm, only : xterm_colors, xterm_pencolor use M_xterm, only : xterm_geometry, xterm_width, xterm_position use M_xterm, only : xterm_clear, xterm_keywords, xterm_labelsuse M_xterm, only : xterm_get_geometry, xterm_get_font, xterm_get_position use M_xterm, only : xterm_get_iconstate, xterm_get_colors, xterm_get_pencolor use M_xterm, only : xterm_xrdb, xterm_occupancy
The xterm(1) terminal emulator emulates an extended VT102 terminal on X11 Windows platforms. This means a number of strings beginning with an escape character can be used to clear the screen, toggle between 80 and 132 column mode, position the cursor, and perform other command sequences that allow screen-based utilities to operate.Since basic terminal control libraries such as ncurses(3c) already exist for basic terminal screen formatting, The M_xterm(3fm) module specifically supports the xterm(1) extensions that control the X11 window attributes such as window size, font, and colors:
xterm_colors(type,color) set xterm colors xterm_font(fontname) set xterm fonts xterm_geometry(rows,cols) set terminal size xterm_position(right,downs) set terminal position xterm_width(iwidth) set width to 80 or 132 characters xterm_clear() clear screen xterm_keywords(keyword) X11 Window Manager hints (lower,raise, maximize,restore,...) and modes xterm_labels(keyword) X11 Window Manager label hintsAn additional set of routines sends escape sequences to stdout that query the current state of the xterm(1). Then, with the terminal set to raw mode, they read back the response. In this implementation that means the command may not work in a basic pipe or have I/O redirected on some systems.
xterm_get_iconstate Query whether window is iconified xterm_get_geometry Get size as number of rows and columns or characters. xterm_get_position Get position of upper left corner of window relative to upper left corner of display in pixels xterm_get_font Get name of current font xterm_get_colors Get colors of various terminal window attributes. xterm_get_pencolor Get description of a terminal color number xterm_xrdb Write out current terminal settings as X11 Windows resources xterm_occupancy Move window to specified virtual display where supported.For all these routines to work with some xterm versions, you may have to set the following X11 resources in your ~.Xresources file **before** starting the xterm(1) window. You may also use the xrdb(1) command. For example
xrdb --merge <<\end_of_file XTerm*VT100.allowWindowOps: true XTerm*VT100.allowTitleOps: true XTerm*VT100.allowFontOps: true end_of_fileFor a running xterm(1), you may use the "VT Fonts" menu to enable "Window Ops","Title Ops","Font Ops", and "Color Ops" if they are no enabled. If the "VT Fonts" menu is not visible in the upper left corner of the xterm(1) display, ctrl-Mouse3 in the main terminal display will make the menu visible.
An example program that can easily be called from scripts and shell aliases called setxt(1) is included
in the GPF (General Purpose Fortran) distribution that this module is a part of.
EXAMPLE
Sample usage:
program demo_M_xterm use M_xterm, only : xterm_colors, xterm_font use M_xterm, only : xterm_geometry, xterm_width, xterm_position use M_xterm, only : xterm_clear, xterm_keywords, xterm_labels call xterm_colors(background,black) call xterm_colors(foreground,white) call xterm_colors(cursor,red) call xterm_colors(mouse_foreground,red) call xterm_colors(mouse_background,white) call xterm_font(5) call xterm_geometry(cols=132,rows=36) call xterm_position(right=100,down=200) call xterm_keywords(raise) end program demo_M_xterm
xlsfonts(1x), clear(1), ncurses(3c), stty (1), tabs (1), terminfo(5), tput (1), tset (1), tty (1)
John S. Urban
Nemo Release 3.1 | M_xterm (3) | February 23, 2025 |