Release 1.6.0.
[xtoys] / xscsize.1
1 .\" -*-nroff-*-
2 .TH xscsize 1 "15 November 1998" "Straylight/Edgeware" "xtoys"
3 .SH NAME
4 xscsize \- return size of an X display to a shell script
5 .SH SYNOPSIS
6 .B xscsize
7 .RB [ \-bcmx ]
8 .RB [ \-d
9 .IR display ]
10 .SH DESCRIPTION
11 The
12 .B xscsize
13 program interrogates an X display and writes the size of the root
14 window to standard output in the form of a shell variable assignment
15 statement. The dimensions are returned in the
16 .B XWIDTH
17 and
18 .B XHEIGHT
19 variables.
20 .PP
21 With the
22 .B \-m
23 option (see below),
24 .B xscsize
25 instead reports the geometry of the individual monitors (CRTCs) of a
26 (possibly) multihead display.
27 .PP
28 Command line options can be used to force output in either Bourne or C
29 shell syntax. In the absence of any explicit instructions,
30 .B xscsize
31 looks at the
32 .B SHELL
33 environment variable to help make its mind up.
34 .PP
35 Typical use would be something like
36 .RS 5
37 .ft B
38 .nf
39 eval `xscsize`
40 .ft R
41 .fi
42 .SS Options
43 .TP 5
44 .BI "\-d, \-\-display " display
45 Choose which display to connect to.
46 .TP 5
47 .B \-b, --bourne-shell
48 Output the assignments in Bourne shell syntax (usable by Bourne,
49 POSIX, Korn, Z and Bourne Again shells).
50 .TP 5
51 .B \-c, --c-shell
52 Output the assignments in C shell syntax (usable by C and Terminal C
53 shells).
54 .TP 5
55 .B \-m, \-\-multiscreen
56 Output geometry information about the individual monitors of a
57 (possibly) multihead display, rather than the overall size of the root
58 window. This sets
59 .B XNSCR
60 to the number of monitors, and
61 .BI XSCR n _X \fR,
62 .BI XSCR n _Y \fR,
63 .BI XSCR n _WIDTH \fR,
64 and
65 .BI XSCR n _HEIGHT \fR
66 to the
67 .IR x -
68 and
69 .IR y -coordinates
70 of the pixel shown in the top-left of monitor
71 .I n
72 (starting from zero), and the width and height of monitor
73 .I n
74 in pixels. The monitors will be sorted in order of increasing
75 .IR y -coordinate
76 (i.e., top to bottom), with monitors with equal
77 .IR y -coordinates
78 sorted in order of increasing
79 .IR x -coordinate
80 (i.e., left to right). Usually, then, the first monitor will be at
81 (0, 0).
82 .IP
83 This requires that support libraries for the X RANDR extension were
84 available when
85 .B xscsize
86 was compiled, and that the display actually implements at least version
87 1.2 of the RANDR extension. If not,
88 .B xscsize
89 will still accept the
90 .B \-m
91 option, and produce appropriately formatted output, but will assume that
92 there is exactly one monitor, and that it shows the entire root window.
93 .TP 5
94 .B \-x, --export
95 Output a variable export command, so that the screen size is inherited
96 by child processes. The default is to just set local shell variables.
97 .SH ENVIRONMENT
98 .TP
99 .B XWIDTH
100 Set to the width of the display in pixels (not in
101 .B \-m
102 mode).
103 .TP
104 .B XHEIGHT
105 Set to the height of the display in pixels (not in
106 .B \-m
107 mode).
108 .TP
109 .B XNSCR
110 The number of monitors attached to the display (only in
111 .B \-m
112 mode).
113 .TP
114 .BI XSCR n _X
115 The
116 .I x -coordinate
117 of the top-left pixel shown on monitor number
118 .I n
119 counting from zero (only in
120 .B \-m
121 mode).
122 .TP
123 .BI XSCR n _Y
124 The
125 .I y -coordinate
126 of the top-left pixel shown on monitor number
127 .I n
128 counting from zero (only in
129 .B \-m
130 mode).
131 .TP
132 .BI XSCR n _WIDTH
133 The width, in pixels, of the portion of the root window shown on monitor
134 number
135 .I n
136 counting from zero (only in
137 .B \-m
138 mode).
139 .TP
140 .BI XSCR n _HEIGHT
141 The height, in pixels, of the portion of the root window shown on monitor
142 number
143 .I n
144 counting from zero (only in
145 .B \-m
146 mode).
147 .TP
148 .B SHELL
149 Used to decide the nature of the calling shell. If absent, a Bourne
150 shell is assumed.
151 .SH BUGS
152 Hopefully none.
153 .SH AUTHOR
154 Mark Wooding (mdw@distorted.org.uk).