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.14 by root, Sun Jan 8 06:35:38 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
29 29
30 You can activate them like this: 30 You can activate them like this:
31 31
32 rxvt -pe <extensionname> 32 rxvt -pe <extensionname>
33 33
34 selection 34 selection (enabled by default)
35 Intelligent selection. This extension tries to be more intelligent 35 Intelligent selection. This extension tries to be more intelligent
36 when the user extends selections (double-click). Right now, it tries 36 when the user extends selections (double-click). Right now, it tries
37 to select urls and complete shell-quoted arguments, which is very 37 to select urls and complete shell-quoted arguments, which is very
38 convenient, too, if your ls supports "--quoting-style=shell". 38 convenient, too, if your ls supports "--quoting-style=shell".
39 39
41 41
42 rot13 42 rot13
43 Rot-13 the selection when activated. Used via keyboard trigger: 43 Rot-13 the selection when activated. Used via keyboard trigger:
44 44
45 URxvt.keysym.C-M-r: perl:selection:rot13 45 URxvt.keysym.C-M-r: perl:selection:rot13
46
47 option-popup (enabled by default)
48 Binds a popup menu to Ctrl-Button3 that lets you toggle (some)
49 options at runtime.
46 50
47 digital-clock 51 digital-clock
48 Displays a digital clock using the built-in overlay. 52 Displays a digital clock using the built-in overlay.
49 53
50 mark-urls 54 mark-urls
96 100
97 The first argument passed to them is an object private to each terminal 101 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 102 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" 103 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" 104 object that is shared between all packages is stored in the "term"
101 member. 105 member. It is, however, blessed intot he package of the extension
106 script, so for all practical purposes you can treat an extension script
107 as a class.
102 108
103 All of them must return a boolean value. If it is true, then the event 109 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 110 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++ 111 skipped, and the relevant action might not be carried out by the C++
106 code. 112 code.
145 double click) and is either supposed to return false (normal 151 double click) and is either supposed to return false (normal
146 operation), or should extend the selection itelf and return true to 152 operation), or should extend the selection itelf and return true to
147 suppress the built-in processing. 153 suppress the built-in processing.
148 154
149 See the selection example extension. 155 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 156
159 on_view_change $term, $offset 157 on_view_change $term, $offset
160 Called whenever the view offset changes, i..e the user or program 158 Called whenever the view offset changes, i..e the user or program
161 scrolls. Offset 0 means display the normal terminal, positive values 159 scrolls. Offset 0 means display the normal terminal, positive values
162 show this many lines of scrollback. 160 show this many lines of scrollback.
219 on_keyboard_command $term, $string 217 on_keyboard_command $term, $string
220 Called whenever the user presses a key combination that has a 218 Called whenever the user presses a key combination that has a
221 "perl:string" action bound to it (see description of the keysym 219 "perl:string" action bound to it (see description of the keysym
222 resource in the rxvt(1) manpage). 220 resource in the rxvt(1) manpage).
223 221
222 on_focus_in $term
223 Called whenever the window gets the keyboard focus, before
224 rxvt-unicode does focus in processing.
225
226 on_focus_out $term
227 Called wheneever the window loses keyboard focus, before
228 rxvt-unicode does focus out processing.
229
224 on_key_press $term, $event, $octets 230 on_key_press $term, $event, $octets
225 on_key_release $term, $event 231 on_key_release $term, $event
226 on_button_press $term, $event 232 on_button_press $term, $event
227 on_button_release $term, $event 233 on_button_release $term, $event
228 on_motion_notify $term, $event 234 on_motion_notify $term, $event
235 on_map_notify $term, $event
236 on_unmap_notify $term, $event
229 Called whenever the corresponding X event is received for the 237 Called whenever the corresponding X event is received for the
230 terminal If the hook returns true, then the even will be ignored by 238 terminal If the hook returns true, then the even will be ignored by
231 rxvt-unicode. 239 rxvt-unicode.
232 240
233 The event is a hash with most values as named by Xlib (see the 241 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. 275 correct place, e.g. on stderr of the connecting urxvtc client.
268 276
269 $time = urxvt::NOW 277 $time = urxvt::NOW
270 Returns the "current time" (as per the event loop). 278 Returns the "current time" (as per the event loop).
271 279
280 urxvt::CurrentTime
281 urxvt::ShiftMask, LockMask, ControlMask, Mod1Mask, Mod2Mask, Mod3Mask,
282 Mod4Mask, Mod5Mask, Button1Mask, Button2Mask, Button3Mask, Button4Mask,
283 Button5Mask, AnyModifier
284 Various constants for use in X calls and event processing.
285
272 RENDITION 286 RENDITION
273 Rendition bitsets contain information about colour, font, font styles 287 Rendition bitsets contain information about colour, font, font styles
274 and similar information for each screen cell. 288 and similar information for each screen cell.
275 289
276 The following "macros" deal with changes in rendition sets. You should 290 The following "macros" deal with changes in rendition sets. You should
306 initially zero. 320 initially zero.
307 321
308 $rend = urxvt::SET_CUSTOM ($rend, $new_value) 322 $rend = urxvt::SET_CUSTOM ($rend, $new_value)
309 Change the custom value. 323 Change the custom value.
310 324
325 The "urxvt::anyevent" Class
326 The sole purpose of this class is to deliver an interface to the
327 "AnyEvent" module - any module using it will work inside urxvt without
328 further work. The only exception is that you cannot wait on condition
329 variables, but non-blocking condvar use is ok. What this means is that
330 you cannot use blocking APIs, but the non-blocking variant should work.
331
311 The "urxvt::term" Class 332 The "urxvt::term" Class
312 $term->destroy 333 $term->destroy
313 Destroy the terminal object (close the window, free resources etc.). 334 Destroy the terminal object (close the window, free resources etc.).
335
336 $isset = $term->option ($optval[, $set])
337 Returns true if the option specified by $optval is enabled, and
338 optionally change it. All option values are stored by name in the
339 hash %urxvt::OPTION. Options not enabled in this binary are not in
340 the hash.
341
342 Here is a a likely non-exhaustive list of option names, please see
343 the source file /src/optinc.h to see the actual list:
344
345 borderLess console cursorBlink cursorUnderline hold iconic insecure
346 intensityStyles jumpScroll loginShell mapAlert meta8 mouseWheelScrollPage
347 pastableTabs pointerBlank reverseVideo scrollBar scrollBar_floating
348 scrollBar_right scrollTtyKeypress scrollTtyOutput scrollWithBuffer
349 secondaryScreen secondaryScroll skipBuiltinGlyphs transparent
350 tripleclickwords utmpInhibit visualBell
314 351
315 $value = $term->resource ($name[, $newval]) 352 $value = $term->resource ($name[, $newval])
316 Returns the current resource value associated with a given name and 353 Returns the current resource value associated with a given name and
317 optionally sets a new value. Setting values is most useful in the 354 optionally sets a new value. Setting values is most useful in the
318 "init" hook. Unset resources are returned and accepted as "undef". 355 "init" hook. Unset resources are returned and accepted as "undef".
328 Please note that resource strings will currently only be freed when 365 Please note that resource strings will currently only be freed when
329 the terminal is destroyed, so changing options frequently will eat 366 the terminal is destroyed, so changing options frequently will eat
330 memory. 367 memory.
331 368
332 Here is a a likely non-exhaustive list of resource names, not all of 369 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 370 which are supported in every build, please see the source file
334 actual list: 371 /src/rsinc.h to see the actual list:
335 372
336 answerbackstring backgroundPixmap backspace_key boldFont boldItalicFont 373 answerbackstring backgroundPixmap backspace_key boldFont boldItalicFont
337 borderLess color cursorBlink cursorUnderline cutchars delete_key 374 borderLess color cursorBlink cursorUnderline cutchars delete_key
338 display_name embed ext_bwidth fade font geometry hold iconName 375 display_name embed ext_bwidth fade font geometry hold iconName
339 imFont imLocale inputMethod insecure int_bwidth intensityStyles 376 imFont imLocale inputMethod insecure int_bwidth intensityStyles
401 $overlay->hide 438 $overlay->hide
402 If visible, hide the overlay, but do not destroy it. 439 If visible, hide the overlay, but do not destroy it.
403 440
404 $overlay->show 441 $overlay->show
405 If hidden, display the overlay again. 442 If hidden, display the overlay again.
443
444 $popup = $term->popup ($event)
445 Creates a new "urxvt::popup" object that implements a popup menu.
446 The $event *must* be the event causing the menu to pop up (a button
447 event, currently).
406 448
407 $cellwidth = $term->strwidth ($string) 449 $cellwidth = $term->strwidth ($string)
408 Returns the number of screen-cells this string would need. Correctly 450 Returns the number of screen-cells this string would need. Correctly
409 accounts for wide and combining characters. 451 accounts for wide and combining characters.
410 452
455 $max_scrollback = $term->saveLines 497 $max_scrollback = $term->saveLines
456 $nrow_plus_saveLines = $term->total_rows 498 $nrow_plus_saveLines = $term->total_rows
457 $lines_in_scrollback = $term->nsaved 499 $lines_in_scrollback = $term->nsaved
458 Return various integers describing terminal characteristics. 500 Return various integers describing terminal characteristics.
459 501
502 $modifiermask = $term->ModLevel3Mask
503 $modifiermask = $term->ModMetaMask
504 $modifiermask = $term->ModNumLockMask
505 Return the modifier masks corresponding to the "ISO Level 3 Shift"
506 (often AltGr), the meta key (often Alt) and the num lock key, if
507 applicable.
508
460 $view_start = $term->view_start ([$newvalue]) 509 $view_start = $term->view_start ([$newvalue])
461 Returns the negative row number of the topmost line. Minimum value 510 Returns the negative row number of the topmost line. Minimum value
462 is 0, which displays the normal terminal contents. Larger values 511 is 0, which displays the normal terminal contents. Larger values
463 scroll this many lines into the scrollback buffer. 512 scroll this many lines into the scrollback buffer.
464 513
550 599
551 $string = $term->special_decode $text 600 $string = $term->special_decode $text
552 Converts rxvt-unicodes text reprsentation into a perl string. See 601 Converts rxvt-unicodes text reprsentation into a perl string. See
553 "$term->ROW_t" for details. 602 "$term->ROW_t" for details.
554 603
604 The "urxvt::popup" Class
555 The "urxvt::timer" Class 605 The "urxvt::timer" Class
556 This class implements timer watchers/events. Time is represented as a 606 This class implements timer watchers/events. Time is represented as
557 fractional number of seconds since the epoch. Example: 607 a fractional number of seconds since the epoch. Example:
558 608
559 $term->{overlay} = $term->overlay (-1, 0, 8, 1, urxvt::OVERLAY_RSTYLE, 0); 609 $term->{overlay} = $term->overlay (-1, 0, 8, 1, urxvt::OVERLAY_RSTYLE, 0);
560 $term->{timer} = urxvt::timer 610 $term->{timer} = urxvt::timer
561 ->new 611 ->new
562 ->interval (1) 612 ->interval (1)
563 ->cb (sub { 613 ->cb (sub {
564 $term->{overlay}->set (0, 0, 614 $term->{overlay}->set (0, 0,
565 sprintf "%2d:%02d:%02d", (localtime urxvt::NOW)[2,1,0]); 615 sprintf "%2d:%02d:%02d", (localtime urxvt::NOW)[2,1,0]);
566 }); 616 });
567 617
568 $timer = new urxvt::timer 618 $timer = new urxvt::timer
569 Create a new timer object in started state. It is scheduled to fire 619 Create a new timer object in started state. It is scheduled to
570 immediately. 620 fire immediately.
571 621
572 $timer = $timer->cb (sub { my ($timer) = @_; ... }) 622 $timer = $timer->cb (sub { my ($timer) = @_; ... })
573 Set the callback to be called when the timer triggers. 623 Set the callback to be called when the timer triggers.
574 624
575 $tstamp = $timer->at 625 $tstamp = $timer->at
576 Return the time this watcher will fire next. 626 Return the time this watcher will fire next.
577 627
578 $timer = $timer->set ($tstamp) 628 $timer = $timer->set ($tstamp)
579 Set the time the event is generated to $tstamp. 629 Set the time the event is generated to $tstamp.
580 630
581 $timer = $timer->interval ($interval) 631 $timer = $timer->interval ($interval)
582 Normally (and when $interval is 0), the timer will automatically 632 Normally (and when $interval is 0), the timer will automatically
583 stop after it has fired once. If $interval is non-zero, then the 633 stop after it has fired once. If $interval is non-zero, then the
584 timer is automatically rescheduled at the given intervals. 634 timer is automatically rescheduled at the given intervals.
585 635
586 $timer = $timer->start 636 $timer = $timer->start
587 Start the timer. 637 Start the timer.
588 638
589 $timer = $timer->start ($tstamp) 639 $timer = $timer->start ($tstamp)
590 Set the event trigger time to $tstamp and start the timer. 640 Set the event trigger time to $tstamp and start the timer.
591 641
592 $timer = $timer->stop 642 $timer = $timer->stop
593 Stop the timer. 643 Stop the timer.
594 644
595 The "urxvt::iow" Class 645 The "urxvt::iow" Class
596 This class implements io watchers/events. Example: 646 This class implements io watchers/events. Example:
597 647
598 $term->{socket} = ... 648 $term->{socket} = ...
599 $term->{iow} = urxvt::iow 649 $term->{iow} = urxvt::iow
600 ->new 650 ->new
601 ->fd (fileno $term->{socket}) 651 ->fd (fileno $term->{socket})
602 ->events (1) # wait for read data 652 ->events (1) # wait for read data
603 ->start 653 ->start
604 ->cb (sub { 654 ->cb (sub {
605 my ($iow, $revents) = @_; 655 my ($iow, $revents) = @_;
606 # $revents must be 1 here, no need to check 656 # $revents must be 1 here, no need to check
607 sysread $term->{socket}, my $buf, 8192 657 sysread $term->{socket}, my $buf, 8192
608 or end-of-file; 658 or end-of-file;
609 }); 659 });
610 660
611 $iow = new urxvt::iow 661 $iow = new urxvt::iow
612 Create a new io watcher object in stopped state. 662 Create a new io watcher object in stopped state.
613 663
614 $iow = $iow->cb (sub { my ($iow, $reventmask) = @_; ... }) 664 $iow = $iow->cb (sub { my ($iow, $reventmask) = @_; ... })
615 Set the callback to be called when io events are triggered. 665 Set the callback to be called when io events are triggered.
616 $reventmask is a bitset as described in the "events" method. 666 $reventmask is a bitset as described in the "events" method.
617 667
618 $iow = $iow->fd ($fd) 668 $iow = $iow->fd ($fd)
619 Set the filedescriptor (not handle) to watch. 669 Set the filedescriptor (not handle) to watch.
620 670
621 $iow = $iow->events ($eventmask) 671 $iow = $iow->events ($eventmask)
622 Set the event mask to watch. Bit #0 (value 1) enables watching for 672 Set the event mask to watch. Bit #0 (value 1) enables watching
623 read data, Bit #1 (value 2) enables watching for write data. 673 for read data, Bit #1 (value 2) enables watching for write data.
624 674
625 $iow = $iow->start 675 $iow = $iow->start
626 Start watching for requested events on the given handle. 676 Start watching for requested events on the given handle.
627 677
628 $iow = $iow->stop 678 $iow = $iow->stop
629 Stop watching for events on the given filehandle. 679 Stop watching for events on the given filehandle.
630 680
631ENVIRONMENT 681ENVIRONMENT
632 URXVT_PERL_VERBOSITY 682 URXVT_PERL_VERBOSITY
633 This variable controls the verbosity level of the perl extension. Higher 683 This variable controls the verbosity level of the perl extension.
634 numbers indicate more verbose output. 684 Higher numbers indicate more verbose output.
635 685
636 =0 - only fatal messages 686 =0 - only fatal messages
637 =3 - script loading and management 687 =3 - script loading and management
638 =10 - all events received 688 =10 - all events received
639 689
640AUTHOR 690AUTHOR
641 Marc Lehmann <pcg@goof.com> 691 Marc Lehmann <pcg@goof.com>
642 http://software.schmorp.de/pkg/rxvt-unicode 692 http://software.schmorp.de/pkg/rxvt-unicode
643 693

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines