Sign in Join
FPDoc Onlineexperiment

DetectXTerm function

In unit Process

Detect the terminal program.

Declaration

pascal
function DetectXTerm: string

Function result

The terminal program to use, or empty if none was found.

Description

DetectXTerm checks if XTermProgram is set. if so, it returns that. If XTermProgram is empty, the list specified in TryTerminals is tested for existence. If none is found, then the DESKTOP_SESSION environment variable is examined:

kde
konsole is used if it is found.
gnome
gnome-terminal is used if it is found
windowmaker
aterm or xterm are used if found.

If after all this, no terminal is found, then a list of default programs is tested: 'x-terminal-emulator','xterm','aterm','wterm','rxvt'.

If a terminal program is found, then it is saved in XTermProgram, so the next call to DetectXTerm will re-use the value. If the search must be performed again, it is sufficient to set XTermProgram to the empty string.

See also

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.