SUMMARY: how do I tell what kind of terminal is in use?

From: Danny Johnson (danny@ews7.dseg.ti.com)
Date: Tue May 18 1993 - 21:07:16 CDT


original request:
   How does a script or program tell whether its X output is
   being sent to a SUN, an X terminal (preferably distinguishing
   between all manufacturers and model numbers), or a PC running
   some kind of X emulator (again distinguishing at least between
   Hummingbird's Exceed/W and NCD's PCXVIEW)? I am not concerned
   with non-graphical environments--I guess this also means you
   can assume some kind of window manager is running.

   (I might also want to know what window manager is running-
   olwm, mwm, ncdwm, Windows [on the PC], etc.)

   I know that X calls can be made to piece together enough
   information such that the answer can be deduced with some
   reasonable level of certainty, but I do not know the details.
   In any case I am looking for something more definitive than
   "if it's 1152x900 pixels it must be a SUN" because (1) that
   is NOT true if the PC is set up to provide a 1152x900 virtual
   screen, and (2) we have some SUNs with a 1280x1024 screen.

   Danny Johnson, Texas Instruments 214-995-8719
-------------------------------------------------
there are two commands that give this information:

1) xrdb -symbols

2) xdpyinfo

------------------

example command use:
From: trinkle@cs.purdue.edu (Daniel Trinkle)

     I think xrdb might help. If you run "xrdb -symbols", you should
get something like

bors 1: xrdb -symbols
 -DHOST=bors.cs.purdue.edu -DSERVERHOST=bors.cs.purdue.edu -DCLIENTHOST=bors.cs.purdue.edu -DVERSION=11 -DREVISION=0 -DVENDOR="MIT X Consortium" -DRELEASE=5000 -DWIDTH=1152 -DHEIGHT=900 -DX_RESOLUTION=3545 -DY_RESOLUTION=3543 -DPLANES=8 -DBITS_PER_RGB=8 -DCLASS=PseudoColor -DCOLOR

     I use this in my X startup (sh) script as follows

# Get server configuration
eval `xrdb -global -symbols | sed 's/-D/\
/g;s/COLOR/COLOR=1/'`

NOTE: the escaped NEWLINE is significant

     The converts each -Dvar=value to var=value and then evaluates the
whole line. The only special case is to change -DCOLOR to COLOR=1.
After this, I can use them as normal shell variables.

-------------------------

PROGRAMMING example:
From: macphed@dvinci.usask.ca (Ian MacPhedran)
>From a program, you would probably want to use:
ServerVendor(*Display dpy)
and
VendorRelease(*Display dpy)

--------------------------
thanks to many other people also.



This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:07:51 CDT