Photon Terminal window
pterm [-ABbcEGLlnPpQqrTUvXZz] [-a font][-C path] [-D fd] [-d path] [-F n] [-f font] [-g RxC] [-H N] [-h height[%]] [-K colors] [-k] [-M RxC] [-m RxC] [-N fd] [-R prefix] [-S i|m|n] [-s server] [-T] [-t string] [-u opts] [-w width[%]] [-x position[%] [r]] [-y position[%][r]] [program [argument...]]
Neutrino
The default values listed below are the ones coded in the pterm application; they might be overridden by a configuration file.
For example, this command sets the initial colors to black (0) on white (7):
pterm -K 07
If server_name is: | This server is used: |
---|---|
node_path | node_path/dev/photon |
fullpath | fullpath |
relative_path | /dev/relative_path |
The pterm application is a terminal emulator that opens a window on the Photon workspace and attaches itself to a character device. The device is usually a pty (pseudo-tty) on the local node, but you can use the -R option to override the node (e.g. if the pty driver isn't running on the local node). Or you can use the -D or -d options to specify a device (e.g. a serial link connected to a modem).
By default, pterm starts a shell on the “slave” side of the pty. The shell won't be spawned if a -D or -d option is used to override the device or if a -N option is used, in which case it outputs the device name to the given file descriptor. In all cases, you can use a command-line argument to force a program to be started on the device.
If the -d option specifies a pty, then the program is started on the specified device and the other side of the pty remains unused (which is probably not the desired behavior). |
Before spawning the command, pterm sets the TERM environment variable to a value depending on the chosen terminal emulation. It'll be one of the following:
You can use the -E option to pass the original environment to the command.
By default, pterm closes its window as soon as the program spawned in it terminates. The -Z or -z option overrides this default — the window remains open until the user closes it. This option can be useful when a program is spawned that outputs a message and then exits immediately.
The -G and -X options can also be useful for a program or script that calls pterm.
If -G is used, then whenever pterm catches a signal other than SIGTERM, SIGCHLD, SIGILL, SIGWINCH or SIGSEGV, the signal is passed to the spawned command. This means that a script can spawn pterm and easily kill its command with a chosen signal.
The -X option causes pterm to exit with the same exit status that the command returned (or even to kill itself with the signal that killed the command).
If the user closes the window while the command is still running, or if pterm catches a signal and either the -G option wasn't specified or it is the SIGTERM signal (which can mean that either Photon is being closed or pterm is being killed using the slay command), pterm:
If the -X option was specified and the command survives both signals, pterm terminates with exit code 1.
If a process running on the pterm's device is producing output very quickly, you can increase the total throughput by running the “consumer” at a priority lower than the “producer.” Data then arrives at the pterm in larger portions. You can further increase the throughput by using larger buffers in the pty driver — pterm uses a 4K buffer, while the pty driver's default is 512 bytes.
You can use the -P or -p option either to reduce pterm's priority or increase the spawned command's priority. Of course, changing the priority has other side effects: if pterm's priority is reduced below the default (-p option), then other processes running at the default priority may significantly reduce the speed of pterm and, as a result, the total throughput. On the other hand, if the process in pterm is running at an increased priority (-P option), then it may affect the performance of other processes, especially when it doesn't produce much output.
You can use the -g option to set an initial terminal size, and the -m and -M options to enforce minimum and maximum sizes. These sizes apply to the terminal, and not the pterm window. If the window is re-sized to be smaller than the minimum size, the terminal is clipped. If the window is re-sized to be larger than the maximum size, the terminal is centered. If there is a conflict between the -g option and either -m or -M, all options are adjusted to reflect the last option specified on the command-line.
You can use these rudimentary clipboard keys:
If you want to: | Press: |
---|---|
Allow text-mode applications to receive mouse events. | Ctrl-Alt-T |
Copy selection to the clipboard. | Ctrl-Alt-X or Ctrl-Alt-Del |
Don't allow text-mode applications to receive mouse events. | Ctrl-Alt-S |
Paste contents of clipboard to the current cursor location. | Ctrl-Alt-V or Ctrl-Alt-Ins |
Paste directly from the selection without using the clipboard. | Ctrl-Alt-P |
Select the word under the cursor or to the left of the cursor. | Ctrl-Alt-W |
Select the word under the cursor or to the left of the cursor and search for that word in Helpviewer. | Ctrl-Alt-H |
Select/Unselect current selection. | Ctrl-Alt-R |
The mouse supports the following user activities within pterm:
If you want to: | Press: |
---|---|
Copy selection to the clipboard. | Right-click or Right-drag (selecting) |
Paste the contents of the clipboard to the current cursor location. | Ctrl-Right button |
Paste from the clipboard. | Middle button |
Paste selection to the current cursor location. | Shift-Right button |
Pop up a menu. | Alt-Right button |
Pop up a menu (if mouse in text mode is disabled). | Right button |
Select a block. | Ctrl-Left button |
Select a block (if mouse in text mode is disabled). | Left button |
Select a “stream.” | Shift-Left button |
Select a word (C identifier). | Alt-Left button, or double-click on the word |
Select the current line | Triple-click on the line |
Select the entire screen | Quadruple-click on the screen |
Several keychords are recognized by pterm:
If you want to: | Press: |
---|---|
Change font | Ctrl-Alt-[ or |
Ctrl-Alt-] or | |
Ctrl-Alt-< or | |
Ctrl-Alt-> | |
Invoke the Terminal Properties dialog. | Ctrl-Alt-C |
Move through the scrollback buffer. | Ctrl-Alt and ↑, ↓, Home, End, Pg Up, or Pg Dn |
The Ctrl-Alt-[ and Ctrl-Alt-] keychords change the font to the previous/next on the list, without changing the terminal size (rows and columns).
Ctrl-Alt-< and Ctrl-Alt-> change the font without changing the window dimensions (measured in pixels). If, however, the new terminal size would be smaller than the minimal size, then the window must be grown. If the new size would be larger than the maximum size, the window won't be made smaller — instead, the terminal's margins are adjusted to fill the window.
You can store certain visible aspects of the terminal in a configuration file (see the “Files” section) and modify them by using the Terminal Properties dialog invoked by Ctrl-Alt-C:
The window title can contain special escape sequences:
Escape | Meaning |
---|---|
%% | A single % character |
%$ | PID of the current process |
%0 | Just the argv[0] argument of the current process executing in the window |
%A | Arguments of the current process executing in the window starting at the argv[0] position |
%a | Arguments of the current process executing in the window starting at the argv[1] position |
%d | Device name (e.g. ttyp1) |
%N | Filename of the current process executing in the window |
%P | Pathname of the current process executing in the window |
%p | Device path (e.g. /dev/ttyp1) |
%T | Current time |
%u | User's login name |
Here you choose the required font for your custom font list:
All the fonts displayed in this dialog must have the same character encoding. By default, pterm assumes it's the PC character set (“IBM code page 437”). If your fonts use a different character encoding, you'll have to specify a charsets file (click “Browse...”) that defines that encoding. See ptermcs for information on creating charset files.
Run pterm using the Photon server on node my_node:
pterm -s/net/my_node/dev/photon
Run pterm at initial position (10,10) with initial dimension of 200×300:
pterm -x10 -y10 -h200 -w300
When pterm is started, it looks for your local configuration file— if that file doesn't exist, a global configuration file is loaded. Whenever you click Save & Close in the Terminal Properties dialog, the local file is saved. The configuration files have the following pathnames:
where $0 is the name used for invoking pterm — usually it's pterm; if $PHOTON_PATH is unset or empty, /usr/photon is used instead.
You can use the -n option to suppress the loading of the current settings from the configuration files. The -c option disables the Terminal Properties dialog.
You can use the -u option to restore the default behavior of the following options: AaBbQv. This option overrides the setup in the configuration file.
You can give several option characters to the -u option at one time (e.g.-uabQv). The -ub and -uB options mean the same thing. The always-blink (-B) and the never-blink (-b) options are two states of a three-state switch. The third state (activated with either -uB or -ub) is “Blink when pterm has focus.”
When pterm is started, it searches for a palette file:
The palette file can be either a binary file containing sixteen 32-bit entries or a text file containing sixteen 8-digit hexadecimal numbers separated by newlines (and terminated with a single newline). If the length of the file is neither 64 nor 144 bytes, the file is assumed invalid.
The palette file is capable of displaying 16 colors: 8 “normal” colors and 8 “bright” colors in the same way that a standard CGA/VGA does. Color numbers are indexes into this array. The default array has 16 elements corresponding to 16 standard CGA colors:
Index | Color |
---|---|
0 | BLACK |
1 | BLUE |
2 | GREEN |
3 | CYAN |
4 | RED |
5 | MAGENTA |
6 | BROWN |
7 | WHITE (light grey) |
8 | BRIGHT BLACK (dark grey) |
9 | BRIGHT BLUE |
10 | BRIGHT GREEN |
11 | BRIGHT CYAN |
12 | BRIGHT RED |
13 | BRIGHT MAGENTA |
14 | BRIGHT BROWN (yellow) |
15 | BRIGHT WHITE |
Using the Command Line and Using the Photon microGUI in the Neutrino User's Guide