ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/doc/rxvtperl.3.txt
(Generate patch)

Comparing rxvt-unicode/doc/rxvtperl.3.txt (file contents):
Revision 1.4 by root, Tue Jan 3 01:39:56 2006 UTC vs.
Revision 1.6 by root, Tue Jan 3 04:20:37 2006 UTC

19 19
20 Scripts are compiled in a 'use strict' and 'use utf8' environment, and 20 Scripts are compiled in a 'use strict' and 'use utf8' environment, and
21 thus must be encoded as UTF-8. 21 thus must be encoded as UTF-8.
22 22
23 Each script will only ever be loaded once, even in rxvtd, where scripts 23 Each script will only ever be loaded once, even in rxvtd, where scripts
24 will be shared (But not enabled) for all terminals. 24 will be shared (but not enabled) for all terminals.
25 25
26PACKAGED EXTENSIONS 26 Prepackaged Extensions
27 This section describes the extensiosn delivered with this version. You 27 This section describes the extensiosn delivered with this version. You
28 can find them in /opt/rxvt/lib/urxvt/perl/. 28 can find them in /opt/rxvt/lib/urxvt/perl/.
29 29
30 You can activate them like this: 30 You can activate them like this:
31 31
38 Rot-13 the selection when activated. Used via keyboard trigger: 38 Rot-13 the selection when activated. Used via keyboard trigger:
39 39
40 URxvt.keysym.C-M-r: perl:selection:rot13 40 URxvt.keysym.C-M-r: perl:selection:rot13
41 41
42 digital-clock 42 digital-clock
43 Displays a digital clock using the built-in overlay.
44
45 example-refresh-hooks
43 Displays a very simple digital clock in the upper right corner of 46 Displays a very simple digital clock in the upper right corner of
44 the window. Illustrates overwriting the refresh callbacks to create 47 the window. Illustrates overwriting the refresh callbacks to create
45 your own overlays or changes. 48 your own overlays or changes.
46
47 simple-overlay-clock
48 Displays a digital clock using the built-in overlay (colorful,
49 useless).
50 49
51 General API Considerations 50 General API Considerations
52 All objects (such as terminals, time watchers etc.) are typical 51 All objects (such as terminals, time watchers etc.) are typical
53 reference-to-hash objects. The hash can be used to store anything you 52 reference-to-hash objects. The hash can be used to store anything you
54 like. All members starting with an underscore (such as "_ptr" or 53 like. All members starting with an underscore (such as "_ptr" or
155 Using this function has the advantage that its output ends up in the 154 Using this function has the advantage that its output ends up in the
156 correct place, e.g. on stderr of the connecting urxvtc client. 155 correct place, e.g. on stderr of the connecting urxvtc client.
157 156
158 $time = urxvt::NOW 157 $time = urxvt::NOW
159 Returns the "current time" (as per the event loop). 158 Returns the "current time" (as per the event loop).
159
160 RENDITION
161 Rendition bitsets contain information about colour, font, font styles
162 and similar information for each screen cell.
163
164 The following "macros" deal with changes in rendition sets. You should
165 never just create a bitset, you should always modify an existing one, as
166 they contain important information required for correct operation of
167 rxvt-unicode.
168
169 $rend = urxvt::DEFAULT_RSTYLE
170 Returns the default rendition, as used when the terminal is starting
171 up or being reset. Useful as a base to start when creating
172 renditions.
173
174 $rend = urxvt::OVERLAY_RSTYLE
175 Return the rendition mask used for overlays by default.
176
177 $rendbit = urxvt::RS_Bold, RS_Italic, RS_Blink, RS_RVid, RS_Uline
178 Return the bit that enabled bold, italic, blink, reverse-video and
179 underline, respectively. To enable such a style, just logically OR
180 it into the bitset.
181
182 $foreground = urxvt::GET_BASEFG $rend
183 $background = urxvt::GET_BASEBG $rend
184 Return the foreground/background colour index, respectively.
185
186 $rend = urxvt::SET_FGCOLOR ($rend, $new_colour)
187 $rend = urxvt::SET_BGCOLOR ($rend, $new_colour)
188 Replace the foreground/background colour in the rendition mask with
189 the specified one.
190
191 $value = urxvt::GET_CUSTOM ($rend)
192 Return the "custom" value: Every rendition has 5 bits for use by
193 extensions. They can be set and changed as you like and are
194 initially zero.
195
196 $rend = urxvt::SET_CUSTOM ($rend, $new_value)
197 Change the custom value.
160 198
161 The "urxvt::term" Class 199 The "urxvt::term" Class
162 $value = $term->resource ($name[, $newval]) 200 $value = $term->resource ($name[, $newval])
163 Returns the current resource value associated with a given name and 201 Returns the current resource value associated with a given name and
164 optionally sets a new value. Setting values is most useful in the 202 optionally sets a new value. Setting values is most useful in the
205 243
206 $oldtext = $term->selection ([$newtext]) 244 $oldtext = $term->selection ([$newtext])
207 Return the current selection text and optionally replace it by 245 Return the current selection text and optionally replace it by
208 $newtext. 246 $newtext.
209 247
210 $term->scr_overlay ($x, $y, $text) 248 #=item $term->overlay ($x, $y, $text) # #Create a simple multi-line
211 Create a simple multi-line overlay box. See the next method for 249 overlay box. See the next method for details. # #=cut
212 details.
213 250
214 $term->scr_overlay_new ($x, $y, $width, $height) 251 sub urxvt::term::scr_overlay { die; my ($self, $x, $y, $text) = @_;
252
253 my @lines = split /\n/, $text;
254
255 my $w = 0;
256 for (map $self->strwidth ($_), @lines) {
257 $w = $_ if $w < $_;
258 }
259
260 $self->scr_overlay_new ($x, $y, $w, scalar @lines);
261 $self->scr_overlay_set (0, $_, $lines[$_]) for 0.. $#lines;
262 }
263
264 $term->overlay ($x, $y, $width, $height[, $rstyle[, $border]])
215 Create a new (empty) overlay at the given position with the given 265 Create a new (empty) overlay at the given position with the given
216 width/height. A border will be put around the box. If either $x or 266 width/height. $rstyle defines the initial rendition style (default:
267 "OVERLAY_RSTYLE").
268
269 If $border is 2 (default), then a decorative border will be put
270 around the box.
271
217 $y is negative, then this is counted from the right/bottom side, 272 If either $x or $y is negative, then this is counted from the
218 respectively. 273 right/bottom side, respectively.
219 274
220 $term->scr_overlay_off 275 This method returns an urxvt::overlay object. The overlay will be
221 Switch the overlay off again. 276 visible as long as the perl object is referenced.
222 277
223 $term->scr_overlay_set_char ($x, $y, $char, $rend = OVERLAY_RSTYLE) 278 Currently, the only method on the "urxvt::overlay" object is "set":
224 Put a single character (specified numerically) at the given overlay
225 position.
226 279
227 $term->scr_overlay_set ($x, $y, $text) 280 $overlay->set ($x, $y, $text, $rend)
228 Write a string at the given position into the overlay. 281 Similar to "$term->ROW_t" and "$term->ROW_r" in that it puts text in
282 rxvt-unicode's special encoding and an array of rendition values at
283 a specific position inside the overlay.
229 284
230 $cellwidth = $term->strwidth $string 285 $cellwidth = $term->strwidth $string
231 Returns the number of screen-cells this string would need. Correctly 286 Returns the number of screen-cells this string would need. Correctly
232 accounts for wide and combining characters. 287 accounts for wide and combining characters.
233 288
270 terminal line. The scrollback buffer starts at line -1 and extends 325 terminal line. The scrollback buffer starts at line -1 and extends
271 to line "-$term->nsaved". 326 to line "-$term->nsaved".
272 327
273 If $new_text is specified, it will replace characters in the current 328 If $new_text is specified, it will replace characters in the current
274 line, starting at column $start_col (default 0), which is useful to 329 line, starting at column $start_col (default 0), which is useful to
275 replace only parts of a line. The font iindex in the rendition will 330 replace only parts of a line. The font index in the rendition will
276 automatically be updated. 331 automatically be updated.
277 332
278 $text is in a special encoding: tabs and wide characters that use 333 $text is in a special encoding: tabs and wide characters that use
279 more than one cell when displayed are padded with urxvt::NOCHAR 334 more than one cell when displayed are padded with urxvt::NOCHAR
280 characters ("chr 65535"). Characters with combining characters and 335 characters ("chr 65535"). Characters with combining characters and
293 Rendition bitsets contain information about colour, font, font 348 Rendition bitsets contain information about colour, font, font
294 styles and similar information. See also "$term->ROW_t". 349 styles and similar information. See also "$term->ROW_t".
295 350
296 When setting rendition, the font mask will be ignored. 351 When setting rendition, the font mask will be ignored.
297 352
298 See the section on RENDITION, below. 353 See the section on RENDITION, above.
299 354
300 $length = $term->ROW_l ($row_number[, $new_length]) 355 $length = $term->ROW_l ($row_number[, $new_length])
301 Returns the number of screen cells that are in use ("the line 356 Returns the number of screen cells that are in use ("the line
302 length"). If it is -1, then the line is part of a multiple-row 357 length"). If it is -1, then the line is part of a multiple-row
303 logical "line", which means all characters are in use and it is 358 logical "line", which means all characters are in use and it is
310 365
311 $string = $term->special_decode $text 366 $string = $term->special_decode $text
312 Converts rxvt-unicodes text reprsentation into a perl string. See 367 Converts rxvt-unicodes text reprsentation into a perl string. See
313 "$term->ROW_t" for details. 368 "$term->ROW_t" for details.
314 369
315 RENDITION
316 Rendition bitsets contain information about colour, font, font styles
317 and similar information for each screen cell.
318
319 The following "macros" deal with changes in rendition sets. You should
320 never just create a bitset, you should always modify an existing one, as
321 they contain important information required for correct operation of
322 rxvt-unicode.
323
324 $rend = urxvt::DEFAULT_RSTYLE
325 Returns the default rendition, as used when the terminal is starting
326 up or being reset. Useful as a base
327
328 The "urxvt::timer" Class 370 The "urxvt::timer" Class
329 This class implements timer watchers/events. Time is represented as a 371 This class implements timer watchers/events. Time is represented as a
330 fractional number of seconds since the epoch. Example: 372 fractional number of seconds since the epoch. Example:
331 373
332 # create a digital clock display in upper right corner 374 $term->{overlay} = $term->overlay (-1, 0, 8, 1, urxvt::OVERLAY_RSTYLE, 0);
333 $term->{timer} = urxvt::timer 375 $term->{timer} = urxvt::timer
334 ->new 376 ->new
335 ->start (urxvt::NOW) 377 ->interval (1)
336 ->cb (sub { 378 ->cb (sub {
337 my ($timer) = @_;
338 my $time = $timer->at;
339 $timer->start ($time + 1);
340 $self->scr_overlay (-1, 0, 379 $term->{overlay}->set (0, 0,
341 POSIX::strftime "%H:%M:%S", localtime $time); 380 sprintf "%2d:%02d:%02d", (localtime urxvt::NOW)[2,1,0]);
342 }); 381 });
343 382
344 $timer = new urxvt::timer 383 $timer = new urxvt::timer
345 Create a new timer object in stopped state. 384 Create a new timer object in started state. It is scheduled to fire
385 immediately.
346 386
347 $timer = $timer->cb (sub { my ($timer) = @_; ... }) 387 $timer = $timer->cb (sub { my ($timer) = @_; ... })
348 Set the callback to be called when the timer triggers. 388 Set the callback to be called when the timer triggers.
349 389
350 $tstamp = $timer->at 390 $tstamp = $timer->at
351 Return the time this watcher will fire next. 391 Return the time this watcher will fire next.
352 392
353 $timer = $timer->set ($tstamp) 393 $timer = $timer->set ($tstamp)
354 Set the time the event is generated to $tstamp. 394 Set the time the event is generated to $tstamp.
395
396 $timer = $timer->interval ($interval)
397 Normally (and when $interval is 0), the timer will automatically
398 stop after it has fired once. If $interval is non-zero, then the
399 timer is automatically rescheduled at the given intervals.
355 400
356 $timer = $timer->start 401 $timer = $timer->start
357 Start the timer. 402 Start the timer.
358 403
359 $timer = $timer->start ($tstamp) 404 $timer = $timer->start ($tstamp)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines