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.12 by root, Sat Jan 7 04:19:43 2006 UTC vs.
Revision 1.13 by root, Sun Jan 8 00:20:12 2006 UTC

12 # start a rxvt using it: 12 # start a rxvt using it:
13 13
14 rxvt --perl-lib $HOME -pe grab_test 14 rxvt --perl-lib $HOME -pe grab_test
15 15
16DESCRIPTION 16DESCRIPTION
17 Everytime a terminal object gets created, scripts specified via the 17 Everytime a terminal object gets created, extension scripts specified
18 "perl" resource are loaded and associated with it. 18 via the "perl" resource are loaded and associated with it.
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
96 96
97 The first argument passed to them is an object private to each terminal 97 The first argument passed to them is an object private to each terminal
98 and extension package. You can call all "urxvt::term" methods on it, but 98 and extension package. You can call all "urxvt::term" methods on it, but
99 its not a real "urxvt::term" object. Instead, the real "urxvt::term" 99 its not a real "urxvt::term" object. Instead, the real "urxvt::term"
100 object that is shared between all packages is stored in the "term" 100 object that is shared between all packages is stored in the "term"
101 member. 101 member. It is, however, blessed intot he package of the extension
102 script, so for all practical purposes you can treat an extension script
103 as a class.
102 104
103 All of them must return a boolean value. If it is true, then the event 105 All of them must return a boolean value. If it is true, then the event
104 counts as being *consumed*, and the invocation of other hooks is 106 counts as being *consumed*, and the invocation of other hooks is
105 skipped, and the relevant action might not be carried out by the C++ 107 skipped, and the relevant action might not be carried out by the C++
106 code. 108 code.
145 double click) and is either supposed to return false (normal 147 double click) and is either supposed to return false (normal
146 operation), or should extend the selection itelf and return true to 148 operation), or should extend the selection itelf and return true to
147 suppress the built-in processing. 149 suppress the built-in processing.
148 150
149 See the selection example extension. 151 See the selection example extension.
150
151 on_focus_in $term
152 Called whenever the window gets the keyboard focus, before urxvt
153 does focus in processing.
154
155 on_focus_out $term
156 Called wheneever the window loses keyboard focus, before urxvt does
157 focus out processing.
158 152
159 on_view_change $term, $offset 153 on_view_change $term, $offset
160 Called whenever the view offset changes, i..e the user or program 154 Called whenever the view offset changes, i..e the user or program
161 scrolls. Offset 0 means display the normal terminal, positive values 155 scrolls. Offset 0 means display the normal terminal, positive values
162 show this many lines of scrollback. 156 show this many lines of scrollback.
219 on_keyboard_command $term, $string 213 on_keyboard_command $term, $string
220 Called whenever the user presses a key combination that has a 214 Called whenever the user presses a key combination that has a
221 "perl:string" action bound to it (see description of the keysym 215 "perl:string" action bound to it (see description of the keysym
222 resource in the rxvt(1) manpage). 216 resource in the rxvt(1) manpage).
223 217
218 on_focus_in $term
219 Called whenever the window gets the keyboard focus, before
220 rxvt-unicode does focus in processing.
221
222 on_focus_out $term
223 Called wheneever the window loses keyboard focus, before
224 rxvt-unicode does focus out processing.
225
224 on_key_press $term, $event, $octets 226 on_key_press $term, $event, $octets
225 on_key_release $term, $event 227 on_key_release $term, $event
226 on_button_press $term, $event 228 on_button_press $term, $event
227 on_button_release $term, $event 229 on_button_release $term, $event
228 on_motion_notify $term, $event 230 on_motion_notify $term, $event
231 on_map_notify $term, $event
232 on_unmap_notify $term, $event
229 Called whenever the corresponding X event is received for the 233 Called whenever the corresponding X event is received for the
230 terminal If the hook returns true, then the even will be ignored by 234 terminal If the hook returns true, then the even will be ignored by
231 rxvt-unicode. 235 rxvt-unicode.
232 236
233 The event is a hash with most values as named by Xlib (see the 237 The event is a hash with most values as named by Xlib (see the
267 correct place, e.g. on stderr of the connecting urxvtc client. 271 correct place, e.g. on stderr of the connecting urxvtc client.
268 272
269 $time = urxvt::NOW 273 $time = urxvt::NOW
270 Returns the "current time" (as per the event loop). 274 Returns the "current time" (as per the event loop).
271 275
276 urxvt::CurrentTime
277 urxvt::ShiftMask, LockMask, ControlMask, Mod1Mask, Mod2Mask, Mod3Mask,
278 Mod4Mask, Mod5Mask, Button1Mask, Button2Mask, Button3Mask, Button4Mask,
279 Button5Mask, AnyModifier
280 Various constants for use in X events.
281
272 RENDITION 282 RENDITION
273 Rendition bitsets contain information about colour, font, font styles 283 Rendition bitsets contain information about colour, font, font styles
274 and similar information for each screen cell. 284 and similar information for each screen cell.
275 285
276 The following "macros" deal with changes in rendition sets. You should 286 The following "macros" deal with changes in rendition sets. You should
310 320
311 The "urxvt::term" Class 321 The "urxvt::term" Class
312 $term->destroy 322 $term->destroy
313 Destroy the terminal object (close the window, free resources etc.). 323 Destroy the terminal object (close the window, free resources etc.).
314 324
325 $isset = $term->option ($optval[, $set])
326 Returns true if the option specified by $optval is enabled, and
327 optionally change it. All option values are stored by name in the
328 hash %urxvt::OPTION. Options not enabled in this binary are not in
329 the hash.
330
331 Here is a a likely non-exhaustive list of option names, please see
332 the source file /src/optinc.h to see the actual list:
333
334 borderLess console cursorBlink cursorUnderline hold iconic insecure
335 intensityStyles jumpScroll loginShell mapAlert meta8 mouseWheelScrollPage
336 pastableTabs pointerBlank reverseVideo scrollBar scrollBar_floating
337 scrollBar_right scrollTtyKeypress scrollTtyOutput scrollWithBuffer
338 secondaryScreen secondaryScroll skipBuiltinGlyphs transparent
339 tripleclickwords utmpInhibit visualBell
340
315 $value = $term->resource ($name[, $newval]) 341 $value = $term->resource ($name[, $newval])
316 Returns the current resource value associated with a given name and 342 Returns the current resource value associated with a given name and
317 optionally sets a new value. Setting values is most useful in the 343 optionally sets a new value. Setting values is most useful in the
318 "init" hook. Unset resources are returned and accepted as "undef". 344 "init" hook. Unset resources are returned and accepted as "undef".
319 345
328 Please note that resource strings will currently only be freed when 354 Please note that resource strings will currently only be freed when
329 the terminal is destroyed, so changing options frequently will eat 355 the terminal is destroyed, so changing options frequently will eat
330 memory. 356 memory.
331 357
332 Here is a a likely non-exhaustive list of resource names, not all of 358 Here is a a likely non-exhaustive list of resource names, not all of
333 which are supported in every build, please see the source to see the 359 which are supported in every build, please see the source file
334 actual list: 360 /src/rsinc.h to see the actual list:
335 361
336 answerbackstring backgroundPixmap backspace_key boldFont boldItalicFont 362 answerbackstring backgroundPixmap backspace_key boldFont boldItalicFont
337 borderLess color cursorBlink cursorUnderline cutchars delete_key 363 borderLess color cursorBlink cursorUnderline cutchars delete_key
338 display_name embed ext_bwidth fade font geometry hold iconName 364 display_name embed ext_bwidth fade font geometry hold iconName
339 imFont imLocale inputMethod insecure int_bwidth intensityStyles 365 imFont imLocale inputMethod insecure int_bwidth intensityStyles
401 $overlay->hide 427 $overlay->hide
402 If visible, hide the overlay, but do not destroy it. 428 If visible, hide the overlay, but do not destroy it.
403 429
404 $overlay->show 430 $overlay->show
405 If hidden, display the overlay again. 431 If hidden, display the overlay again.
432
433 $popup = $term->popup ($event)
434 Creates a new "urxvt::popup" object that implements a popup menu.
435 The $event *must* be the event causing the menu to pop up (a button
436 event, currently).
406 437
407 $cellwidth = $term->strwidth ($string) 438 $cellwidth = $term->strwidth ($string)
408 Returns the number of screen-cells this string would need. Correctly 439 Returns the number of screen-cells this string would need. Correctly
409 accounts for wide and combining characters. 440 accounts for wide and combining characters.
410 441
455 $max_scrollback = $term->saveLines 486 $max_scrollback = $term->saveLines
456 $nrow_plus_saveLines = $term->total_rows 487 $nrow_plus_saveLines = $term->total_rows
457 $lines_in_scrollback = $term->nsaved 488 $lines_in_scrollback = $term->nsaved
458 Return various integers describing terminal characteristics. 489 Return various integers describing terminal characteristics.
459 490
491 $modifiermask = $term->ModLevel3Mask
492 $modifiermask = $term->ModMetaMask
493 $modifiermask = $term->ModNumLockMask
494 Return the modifier masks corresponding to the "ISO Level 3 Shift"
495 (often AltGr), the meta key (often Alt) and the num lock key, if
496 applicable.
497
460 $view_start = $term->view_start ([$newvalue]) 498 $view_start = $term->view_start ([$newvalue])
461 Returns the negative row number of the topmost line. Minimum value 499 Returns the negative row number of the topmost line. Minimum value
462 is 0, which displays the normal terminal contents. Larger values 500 is 0, which displays the normal terminal contents. Larger values
463 scroll this many lines into the scrollback buffer. 501 scroll this many lines into the scrollback buffer.
464 502
550 588
551 $string = $term->special_decode $text 589 $string = $term->special_decode $text
552 Converts rxvt-unicodes text reprsentation into a perl string. See 590 Converts rxvt-unicodes text reprsentation into a perl string. See
553 "$term->ROW_t" for details. 591 "$term->ROW_t" for details.
554 592
593 The "urxvt::popup" Class
555 The "urxvt::timer" Class 594 The "urxvt::timer" Class
556 This class implements timer watchers/events. Time is represented as a 595 This class implements timer watchers/events. Time is represented as
557 fractional number of seconds since the epoch. Example: 596 a fractional number of seconds since the epoch. Example:
558 597
559 $term->{overlay} = $term->overlay (-1, 0, 8, 1, urxvt::OVERLAY_RSTYLE, 0); 598 $term->{overlay} = $term->overlay (-1, 0, 8, 1, urxvt::OVERLAY_RSTYLE, 0);
560 $term->{timer} = urxvt::timer 599 $term->{timer} = urxvt::timer
561 ->new 600 ->new
562 ->interval (1) 601 ->interval (1)
563 ->cb (sub { 602 ->cb (sub {
564 $term->{overlay}->set (0, 0, 603 $term->{overlay}->set (0, 0,
565 sprintf "%2d:%02d:%02d", (localtime urxvt::NOW)[2,1,0]); 604 sprintf "%2d:%02d:%02d", (localtime urxvt::NOW)[2,1,0]);
566 }); 605 });
567 606
568 $timer = new urxvt::timer 607 $timer = new urxvt::timer
569 Create a new timer object in started state. It is scheduled to fire 608 Create a new timer object in started state. It is scheduled to
570 immediately. 609 fire immediately.
571 610
572 $timer = $timer->cb (sub { my ($timer) = @_; ... }) 611 $timer = $timer->cb (sub { my ($timer) = @_; ... })
573 Set the callback to be called when the timer triggers. 612 Set the callback to be called when the timer triggers.
574 613
575 $tstamp = $timer->at 614 $tstamp = $timer->at
576 Return the time this watcher will fire next. 615 Return the time this watcher will fire next.
577 616
578 $timer = $timer->set ($tstamp) 617 $timer = $timer->set ($tstamp)
579 Set the time the event is generated to $tstamp. 618 Set the time the event is generated to $tstamp.
580 619
581 $timer = $timer->interval ($interval) 620 $timer = $timer->interval ($interval)
582 Normally (and when $interval is 0), the timer will automatically 621 Normally (and when $interval is 0), the timer will automatically
583 stop after it has fired once. If $interval is non-zero, then the 622 stop after it has fired once. If $interval is non-zero, then the
584 timer is automatically rescheduled at the given intervals. 623 timer is automatically rescheduled at the given intervals.
585 624
586 $timer = $timer->start 625 $timer = $timer->start
587 Start the timer. 626 Start the timer.
588 627
589 $timer = $timer->start ($tstamp) 628 $timer = $timer->start ($tstamp)
590 Set the event trigger time to $tstamp and start the timer. 629 Set the event trigger time to $tstamp and start the timer.
591 630
592 $timer = $timer->stop 631 $timer = $timer->stop
593 Stop the timer. 632 Stop the timer.
594 633
595 The "urxvt::iow" Class 634 The "urxvt::iow" Class
596 This class implements io watchers/events. Example: 635 This class implements io watchers/events. Example:
597 636
598 $term->{socket} = ... 637 $term->{socket} = ...
599 $term->{iow} = urxvt::iow 638 $term->{iow} = urxvt::iow
600 ->new 639 ->new
601 ->fd (fileno $term->{socket}) 640 ->fd (fileno $term->{socket})
602 ->events (1) # wait for read data 641 ->events (1) # wait for read data
603 ->start 642 ->start
604 ->cb (sub { 643 ->cb (sub {
605 my ($iow, $revents) = @_; 644 my ($iow, $revents) = @_;
606 # $revents must be 1 here, no need to check 645 # $revents must be 1 here, no need to check
607 sysread $term->{socket}, my $buf, 8192 646 sysread $term->{socket}, my $buf, 8192
608 or end-of-file; 647 or end-of-file;
609 }); 648 });
610 649
611 $iow = new urxvt::iow 650 $iow = new urxvt::iow
612 Create a new io watcher object in stopped state. 651 Create a new io watcher object in stopped state.
613 652
614 $iow = $iow->cb (sub { my ($iow, $reventmask) = @_; ... }) 653 $iow = $iow->cb (sub { my ($iow, $reventmask) = @_; ... })
615 Set the callback to be called when io events are triggered. 654 Set the callback to be called when io events are triggered.
616 $reventmask is a bitset as described in the "events" method. 655 $reventmask is a bitset as described in the "events" method.
617 656
618 $iow = $iow->fd ($fd) 657 $iow = $iow->fd ($fd)
619 Set the filedescriptor (not handle) to watch. 658 Set the filedescriptor (not handle) to watch.
620 659
621 $iow = $iow->events ($eventmask) 660 $iow = $iow->events ($eventmask)
622 Set the event mask to watch. Bit #0 (value 1) enables watching for 661 Set the event mask to watch. Bit #0 (value 1) enables watching
623 read data, Bit #1 (value 2) enables watching for write data. 662 for read data, Bit #1 (value 2) enables watching for write data.
624 663
625 $iow = $iow->start 664 $iow = $iow->start
626 Start watching for requested events on the given handle. 665 Start watching for requested events on the given handle.
627 666
628 $iow = $iow->stop 667 $iow = $iow->stop
629 Stop watching for events on the given filehandle. 668 Stop watching for events on the given filehandle.
630 669
631ENVIRONMENT 670ENVIRONMENT
632 URXVT_PERL_VERBOSITY 671 URXVT_PERL_VERBOSITY
633 This variable controls the verbosity level of the perl extension. Higher 672 This variable controls the verbosity level of the perl extension.
634 numbers indicate more verbose output. 673 Higher numbers indicate more verbose output.
635 674
636 =0 - only fatal messages 675 =0 - only fatal messages
637 =3 - script loading and management 676 =3 - script loading and management
638 =10 - all events received 677 =10 - all events received
639 678
640AUTHOR 679AUTHOR
641 Marc Lehmann <pcg@goof.com> 680 Marc Lehmann <pcg@goof.com>
642 http://software.schmorp.de/pkg/rxvt-unicode 681 http://software.schmorp.de/pkg/rxvt-unicode
643 682

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines