ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/doc/rxvtperl.3.man.in
Revision: 1.1
Committed: Mon Jan 2 15:59:25 2006 UTC (18 years, 6 months ago) by root
Branch: MAIN
Log Message:
*** empty log message ***

File Contents

# User Rev Content
1 root 1.1 .\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.14
2     .\"
3     .\" Standard preamble:
4     .\" ========================================================================
5     .de Sh \" Subsection heading
6     .br
7     .if t .Sp
8     .ne 5
9     .PP
10     \fB\\$1\fR
11     .PP
12     ..
13     .de Sp \" Vertical space (when we can't use .PP)
14     .if t .sp .5v
15     .if n .sp
16     ..
17     .de Vb \" Begin verbatim text
18     .ft CW
19     .nf
20     .ne \\$1
21     ..
22     .de Ve \" End verbatim text
23     .ft R
24     .fi
25     ..
26     .\" Set up some character translations and predefined strings. \*(-- will
27     .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
28     .\" double quote, and \*(R" will give a right double quote. | will give a
29     .\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to
30     .\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C'
31     .\" expand to `' in nroff, nothing in troff, for use with C<>.
32     .tr \(*W-|\(bv\*(Tr
33     .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
34     .ie n \{\
35     . ds -- \(*W-
36     . ds PI pi
37     . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
38     . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
39     . ds L" ""
40     . ds R" ""
41     . ds C` ""
42     . ds C' ""
43     'br\}
44     .el\{\
45     . ds -- \|\(em\|
46     . ds PI \(*p
47     . ds L" ``
48     . ds R" ''
49     'br\}
50     .\"
51     .\" If the F register is turned on, we'll generate index entries on stderr for
52     .\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
53     .\" entries marked with X<> in POD. Of course, you'll have to process the
54     .\" output yourself in some meaningful fashion.
55     .if \nF \{\
56     . de IX
57     . tm Index:\\$1\t\\n%\t"\\$2"
58     ..
59     . nr % 0
60     . rr F
61     .\}
62     .\"
63     .\" For nroff, turn off justification. Always turn off hyphenation; it makes
64     .\" way too many mistakes in technical documents.
65     .hy 0
66     .if n .na
67     .\"
68     .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
69     .\" Fear. Run. Save yourself. No user-serviceable parts.
70     . \" fudge factors for nroff and troff
71     .if n \{\
72     . ds #H 0
73     . ds #V .8m
74     . ds #F .3m
75     . ds #[ \f1
76     . ds #] \fP
77     .\}
78     .if t \{\
79     . ds #H ((1u-(\\\\n(.fu%2u))*.13m)
80     . ds #V .6m
81     . ds #F 0
82     . ds #[ \&
83     . ds #] \&
84     .\}
85     . \" simple accents for nroff and troff
86     .if n \{\
87     . ds ' \&
88     . ds ` \&
89     . ds ^ \&
90     . ds , \&
91     . ds ~ ~
92     . ds /
93     .\}
94     .if t \{\
95     . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
96     . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
97     . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
98     . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
99     . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
100     . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
101     .\}
102     . \" troff and (daisy-wheel) nroff accents
103     .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
104     .ds 8 \h'\*(#H'\(*b\h'-\*(#H'
105     .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
106     .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
107     .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
108     .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
109     .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
110     .ds ae a\h'-(\w'a'u*4/10)'e
111     .ds Ae A\h'-(\w'A'u*4/10)'E
112     . \" corrections for vroff
113     .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
114     .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
115     . \" for low resolution devices (crt and lpr)
116     .if \n(.H>23 .if \n(.V>19 \
117     \{\
118     . ds : e
119     . ds 8 ss
120     . ds o a
121     . ds d- d\h'-1'\(ga
122     . ds D- D\h'-1'\(hy
123     . ds th \o'bp'
124     . ds Th \o'LP'
125     . ds ae ae
126     . ds Ae AE
127     .\}
128     .rm #[ #] #H #V #F C
129     .\" ========================================================================
130     .\"
131     .IX Title "rxvt 3"
132     .TH rxvt 3 "2006-01-02" "6.2" "RXVT-UNICODE"
133     .SH "NAME"
134     rxvtperl \- rxvt\-unicode's embedded perl interpreter
135     .SH "SYNOPSIS"
136     .IX Header "SYNOPSIS"
137     * Put your scripts into \fI@@RXVT_LIBDIR@@/urxvt/perl\-ext/\fR, they will be loaded automatically.
138     .PP
139     * Each script will only be loaded once, even in urxvtd, and will be valid
140     globally.
141     .PP
142     * Scripts are evaluated in a 'use strict' and 'use utf8' environment, and
143     thus must be encoded as \s-1UTF\-8\s0.
144     .PP
145     .Vb 4
146     \& sub on_sel_grab {
147     \& warn "you selected ", $_[0]->selection;
148     \& ()
149     \& }
150     .Ve
151     .PP
152     .Vb 1
153     \& 1
154     .Ve
155     .SH "DESCRIPTION"
156     .IX Header "DESCRIPTION"
157     .Sh "Hooks"
158     .IX Subsection "Hooks"
159     The following subroutines can be declared in loaded scripts, and will be called
160     whenever the relevant event happens.
161     .PP
162     All of them must return a boolean value. If it is true, then the event
163     counts as being \fIconsumed\fR, and the invocation of other hooks is skipped,
164     and the relevant action might not be carried out by the \*(C+ code.
165     .PP
166     When in doubt, return a false value (preferably \f(CW\*(C`()\*(C'\fR).
167     .ie n .IP "on_init $term" 4
168     .el .IP "on_init \f(CW$term\fR" 4
169     .IX Item "on_init $term"
170     Called after a new terminal object has been initialized, but before
171     windows are created or the command gets run.
172     .ie n .IP "on_reset $term" 4
173     .el .IP "on_reset \f(CW$term\fR" 4
174     .IX Item "on_reset $term"
175     Called after the screen is \*(L"reset\*(R" for any reason, such as resizing or
176     control sequences. Here is where you can react on changes to size-related
177     variables.
178     .ie n .IP "on_start $term" 4
179     .el .IP "on_start \f(CW$term\fR" 4
180     .IX Item "on_start $term"
181     Called at the very end of initialisation of a new terminal, just before
182     returning to the mainloop.
183     .ie n .IP "on_sel_make $term\fR, \f(CW$eventtime" 4
184     .el .IP "on_sel_make \f(CW$term\fR, \f(CW$eventtime\fR" 4
185     .IX Item "on_sel_make $term, $eventtime"
186     Called whenever a selection has been made by the user, but before the
187     selection text is copied, so changes to the beginning, end or type of the
188     selection will be honored.
189     .Sp
190     Returning a true value aborts selection making by urxvt, in which case you
191     have to make a selection yourself by calling \f(CW\*(C`$term\->selection_grab\*(C'\fR.
192     .ie n .IP "on_sel_grab $term\fR, \f(CW$eventtime" 4
193     .el .IP "on_sel_grab \f(CW$term\fR, \f(CW$eventtime\fR" 4
194     .IX Item "on_sel_grab $term, $eventtime"
195     Called whenever a selection has been copied, but before the selection is
196     requested from the server. The selection text can be queried and changed
197     by calling \f(CW\*(C`$term\->selection\*(C'\fR.
198     .Sp
199     Returning a true value aborts selection grabbing. It will still be hilighted.
200     .ie n .IP "on_focus_in $term" 4
201     .el .IP "on_focus_in \f(CW$term\fR" 4
202     .IX Item "on_focus_in $term"
203     Called whenever the window gets the keyboard focus, before urxvt does
204     focus in processing.
205     .ie n .IP "on_focus_out $term" 4
206     .el .IP "on_focus_out \f(CW$term\fR" 4
207     .IX Item "on_focus_out $term"
208     Called wheneever the window loses keyboard focus, before urxvt does focus
209     out processing.
210     .ie n .IP "on_view_change $term\fR, \f(CW$offset" 4
211     .el .IP "on_view_change \f(CW$term\fR, \f(CW$offset\fR" 4
212     .IX Item "on_view_change $term, $offset"
213     Called whenever the view offset changes, i..e the user or program
214     scrolls. Offset \f(CW0\fR means display the normal terminal, positive values
215     show this many lines of scrollback.
216     .ie n .IP "on_scroll_back $term\fR, \f(CW$lines\fR, \f(CW$saved" 4
217     .el .IP "on_scroll_back \f(CW$term\fR, \f(CW$lines\fR, \f(CW$saved\fR" 4
218     .IX Item "on_scroll_back $term, $lines, $saved"
219     Called whenever lines scroll out of the terminal area into the scrollback
220     buffer. \f(CW$lines\fR is the number of lines scrolled out and may be larger
221     than the scroll back buffer or the terminal.
222     .Sp
223     It is called before lines are scrolled out (so rows 0 .. min ($lines \- 1,
224     \&\f(CW$nrow\fR \- 1) represent the lines to be scrolled out). \f(CW$saved\fR is the total
225     number of lines that will be in the scrollback buffer.
226     .ie n .IP "on_tty_activity $term *NYI*" 4
227     .el .IP "on_tty_activity \f(CW$term\fR *NYI*" 4
228     .IX Item "on_tty_activity $term *NYI*"
229     Called whenever the program(s) running in the urxvt window send output.
230     .ie n .IP "on_refresh_begin $term" 4
231     .el .IP "on_refresh_begin \f(CW$term\fR" 4
232     .IX Item "on_refresh_begin $term"
233     Called just before the screen gets redrawn. Can be used for overlay
234     or similar effects by modify terminal contents in refresh_begin, and
235     restoring them in refresh_end. The built-in overlay and selection display
236     code is run after this hook, and takes precedence.
237     .ie n .IP "on_refresh_end $term" 4
238     .el .IP "on_refresh_end \f(CW$term\fR" 4
239     .IX Item "on_refresh_end $term"
240     Called just after the screen gets redrawn. See \f(CW\*(C`on_refresh_begin\*(C'\fR.
241     .ie n .Sh "Functions in the ""urxvt"" Package"
242     .el .Sh "Functions in the \f(CWurxvt\fP Package"
243     .IX Subsection "Functions in the urxvt Package"
244     .ie n .IP "urxvt::fatal $errormessage" 4
245     .el .IP "urxvt::fatal \f(CW$errormessage\fR" 4
246     .IX Item "urxvt::fatal $errormessage"
247     Fatally aborts execution with the given error message. Avoid at all
248     costs! The only time this is acceptable is when the terminal process
249     starts up.
250     .ie n .IP "urxvt::warn $string" 4
251     .el .IP "urxvt::warn \f(CW$string\fR" 4
252     .IX Item "urxvt::warn $string"
253     Calls \f(CW\*(C`rxvt_warn\*(C'\fR witht eh given string which should not include a
254     newline. The module also overwrites the \f(CW\*(C`warn\*(C'\fR builtin with a function
255     that calls this function.
256     .Sp
257     Using this function has the advantage that its output ends up in the
258     correct place, e.g. on stderr of the connecting urxvtc client.
259     .ie n .IP "$cellwidth = urxvt::wcswidth $string" 4
260     .el .IP "$cellwidth = urxvt::wcswidth \f(CW$string\fR" 4
261     .IX Item "$cellwidth = urxvt::wcswidth $string"
262     Returns the number of screen-cells this string would need. Correctly
263     accounts for wide and combining characters.
264     .IP "$time = urxvt::NOW" 4
265     .IX Item "$time = urxvt::NOW"
266     Returns the \*(L"current time\*(R" (as per the event loop).
267     .ie n .Sh "The ""urxvt::term"" Class"
268     .el .Sh "The \f(CWurxvt::term\fP Class"
269     .IX Subsection "The urxvt::term Class"
270     .ie n .IP "($row, $col\fR) = \f(CW$term\fR\->selection_mark ([$row, \f(CW$col])" 4
271     .el .IP "($row, \f(CW$col\fR) = \f(CW$term\fR\->selection_mark ([$row, \f(CW$col\fR])" 4
272     .IX Item "($row, $col) = $term->selection_mark ([$row, $col])"
273     .PD 0
274     .ie n .IP "($row, $col\fR) = \f(CW$term\fR\->selection_beg ([$row, \f(CW$col])" 4
275     .el .IP "($row, \f(CW$col\fR) = \f(CW$term\fR\->selection_beg ([$row, \f(CW$col\fR])" 4
276     .IX Item "($row, $col) = $term->selection_beg ([$row, $col])"
277     .ie n .IP "($row, $col\fR) = \f(CW$term\fR\->selection_end ([$row, \f(CW$col])" 4
278     .el .IP "($row, \f(CW$col\fR) = \f(CW$term\fR\->selection_end ([$row, \f(CW$col\fR])" 4
279     .IX Item "($row, $col) = $term->selection_end ([$row, $col])"
280     .PD
281     Return the current values of the selection mark, begin or end positions,
282     and optionally set them to new values.
283     .ie n .IP "$success = $term\->selection_grab ($eventtime)" 4
284     .el .IP "$success = \f(CW$term\fR\->selection_grab ($eventtime)" 4
285     .IX Item "$success = $term->selection_grab ($eventtime)"
286     Try to request the primary selection from the server (for example, as set
287     by the next method).
288     .ie n .IP "$oldtext = $term\->selection ([$newtext])" 4
289     .el .IP "$oldtext = \f(CW$term\fR\->selection ([$newtext])" 4
290     .IX Item "$oldtext = $term->selection ([$newtext])"
291     Return the current selection text and optionally replace it by \f(CW$newtext\fR.
292     .ie n .IP "$term\->scr_overlay ($x, $y\fR, \f(CW$text)" 4
293     .el .IP "$term\->scr_overlay ($x, \f(CW$y\fR, \f(CW$text\fR)" 4
294     .IX Item "$term->scr_overlay ($x, $y, $text)"
295     Create a simple multi-line overlay box. See the next method for details.
296     .ie n .IP "$term\->scr_overlay_new ($x, $y\fR, \f(CW$width\fR, \f(CW$height)" 4
297     .el .IP "$term\->scr_overlay_new ($x, \f(CW$y\fR, \f(CW$width\fR, \f(CW$height\fR)" 4
298     .IX Item "$term->scr_overlay_new ($x, $y, $width, $height)"
299     Create a new (empty) overlay at the given position with the given
300     width/height. A border will be put around the box. If either \f(CW$x\fR or
301     \&\f(CW$y\fR is negative, then this is counted from the right/bottom side,
302     respectively.
303     .IP "$term\->scr_overlay_off" 4
304     .IX Item "$term->scr_overlay_off"
305     Switch the overlay off again.
306     .ie n .IP "$term\->scr_overlay_set_char ($x, $y\fR, \f(CW$char\fR, \f(CW$rend = \s-1OVERLAY_RSTYLE\s0)" 4
307     .el .IP "$term\->scr_overlay_set_char ($x, \f(CW$y\fR, \f(CW$char\fR, \f(CW$rend\fR = \s-1OVERLAY_RSTYLE\s0)" 4
308     .IX Item "$term->scr_overlay_set_char ($x, $y, $char, $rend = OVERLAY_RSTYLE)"
309     Put a single character (specified numerically) at the given overlay
310     position.
311     .ie n .IP "$term\->scr_overlay_set ($x, $y\fR, \f(CW$text)" 4
312     .el .IP "$term\->scr_overlay_set ($x, \f(CW$y\fR, \f(CW$text\fR)" 4
313     .IX Item "$term->scr_overlay_set ($x, $y, $text)"
314     Write a string at the given position into the overlay.
315     .ie n .Sh "The ""urxvt::timer"" Class"
316     .el .Sh "The \f(CWurxvt::timer\fP Class"
317     .IX Subsection "The urxvt::timer Class"
318     This class implements timer watchers/events. Time is represented as a
319     fractional number of seconds since the epoch. Example:
320     .PP
321     .Vb 11
322     \& # create a digital clock display in upper right corner
323     \& $term->{timer} = urxvt::timer
324     \& ->new
325     \& ->start (urxvt::NOW)
326     \& ->cb (sub {
327     \& my ($timer) = @_;
328     \& my $time = $timer->at;
329     \& $timer->start ($time + 1);
330     \& $self->scr_overlay (-1, 0,
331     \& POSIX::strftime "%H:%M:%S", localtime $time);
332     \& });
333     .Ve
334     .IP "$timer = new urxvt::timer" 4
335     .IX Item "$timer = new urxvt::timer"
336     Create a new timer object in stopped state.
337     .ie n .IP "$timer = $timer\fR\->cb (sub { my ($timer) = \f(CW@_; ... })" 4
338     .el .IP "$timer = \f(CW$timer\fR\->cb (sub { my ($timer) = \f(CW@_\fR; ... })" 4
339     .IX Item "$timer = $timer->cb (sub { my ($timer) = @_; ... })"
340     Set the callback to be called when the timer triggers.
341     .ie n .IP "$tstamp = $timer\->at" 4
342     .el .IP "$tstamp = \f(CW$timer\fR\->at" 4
343     .IX Item "$tstamp = $timer->at"
344     Return the time this watcher will fire next.
345     .ie n .IP "$timer = $timer\->set ($tstamp)" 4
346     .el .IP "$timer = \f(CW$timer\fR\->set ($tstamp)" 4
347     .IX Item "$timer = $timer->set ($tstamp)"
348     Set the time the event is generated to \f(CW$tstamp\fR.
349     .ie n .IP "$timer = $timer\->start" 4
350     .el .IP "$timer = \f(CW$timer\fR\->start" 4
351     .IX Item "$timer = $timer->start"
352     Start the timer.
353     .ie n .IP "$timer = $timer\->start ($tstamp)" 4
354     .el .IP "$timer = \f(CW$timer\fR\->start ($tstamp)" 4
355     .IX Item "$timer = $timer->start ($tstamp)"
356     Set the event trigger time to \f(CW$tstamp\fR and start the timer.
357     .ie n .IP "$timer = $timer\->stop" 4
358     .el .IP "$timer = \f(CW$timer\fR\->stop" 4
359     .IX Item "$timer = $timer->stop"
360     Stop the timer.
361     .ie n .Sh "The ""urxvt::iow"" Class"
362     .el .Sh "The \f(CWurxvt::iow\fP Class"
363     .IX Subsection "The urxvt::iow Class"
364     This class implements io watchers/events. Example:
365     .PP
366     .Vb 12
367     \& $term->{socket} = ...
368     \& $term->{iow} = urxvt::iow
369     \& ->new
370     \& ->fd (fileno $term->{socket})
371     \& ->events (1) # wait for read data
372     \& ->start
373     \& ->cb (sub {
374     \& my ($iow, $revents) = @_;
375     \& # $revents must be 1 here, no need to check
376     \& sysread $term->{socket}, my $buf, 8192
377     \& or end-of-file;
378     \& });
379     .Ve
380     .IP "$iow = new urxvt::iow" 4
381     .IX Item "$iow = new urxvt::iow"
382     Create a new io watcher object in stopped state.
383     .ie n .IP "$iow = $iow\fR\->cb (sub { my ($iow, \f(CW$reventmask\fR) = \f(CW@_; ... })" 4
384     .el .IP "$iow = \f(CW$iow\fR\->cb (sub { my ($iow, \f(CW$reventmask\fR) = \f(CW@_\fR; ... })" 4
385     .IX Item "$iow = $iow->cb (sub { my ($iow, $reventmask) = @_; ... })"
386     Set the callback to be called when io events are triggered. \f(CW$reventmask\fR
387     is a bitset as described in the \f(CW\*(C`events\*(C'\fR method.
388     .ie n .IP "$iow = $iow\->fd ($fd)" 4
389     .el .IP "$iow = \f(CW$iow\fR\->fd ($fd)" 4
390     .IX Item "$iow = $iow->fd ($fd)"
391     Set the filedescriptor (not handle) to watch.
392     .ie n .IP "$iow = $iow\->events ($eventmask)" 4
393     .el .IP "$iow = \f(CW$iow\fR\->events ($eventmask)" 4
394     .IX Item "$iow = $iow->events ($eventmask)"
395     Set the event mask to watch. Bit #0 (value \f(CW1\fR) enables watching for read
396     data, Bit #1 (value \f(CW2\fR) enables watching for write data.
397     .ie n .IP "$iow = $iow\->start" 4
398     .el .IP "$iow = \f(CW$iow\fR\->start" 4
399     .IX Item "$iow = $iow->start"
400     Start watching for requested events on the given handle.
401     .ie n .IP "$iow = $iow\->stop" 4
402     .el .IP "$iow = \f(CW$iow\fR\->stop" 4
403     .IX Item "$iow = $iow->stop"
404     Stop watching for events on the given filehandle.
405     .SH "AUTHOR"
406     .IX Header "AUTHOR"
407     .Vb 2
408     \& Marc Lehmann <pcg@goof.com>
409     \& http://software.schmorp.de/pkg/rxvt-unicode
410     .Ve