… | |
… | |
137 | =over 4 |
137 | =over 4 |
138 | |
138 | |
139 | =item on_init $term |
139 | =item on_init $term |
140 | |
140 | |
141 | Called after a new terminal object has been initialized, but before |
141 | Called after a new terminal object has been initialized, but before |
142 | windows are created or the command gets run. |
142 | windows are created or the command gets run. Most methods are unsafe to |
|
|
143 | call or deliver senseless data, as terminal size and other characteristics |
|
|
144 | have not yet been determined. You can safely query and change resources, |
|
|
145 | though. |
143 | |
146 | |
144 | =item on_reset $term |
147 | =item on_reset $term |
145 | |
148 | |
146 | Called after the screen is "reset" for any reason, such as resizing or |
149 | Called after the screen is "reset" for any reason, such as resizing or |
147 | control sequences. Here is where you can react on changes to size-related |
150 | control sequences. Here is where you can react on changes to size-related |
… | |
… | |
258 | |
261 | |
259 | Called whenever the user presses a key combination that has a |
262 | Called whenever the user presses a key combination that has a |
260 | C<perl:string> action bound to it (see description of the B<keysym> |
263 | C<perl:string> action bound to it (see description of the B<keysym> |
261 | resource in the @@RXVT_NAME@@(1) manpage). |
264 | resource in the @@RXVT_NAME@@(1) manpage). |
262 | |
265 | |
|
|
266 | =item on_key_press $term, $event, $octets |
|
|
267 | |
|
|
268 | =item on_key_release $term, $event |
|
|
269 | |
|
|
270 | =item on_button_press $term, $event |
|
|
271 | |
|
|
272 | =item on_button_release $term, $event |
|
|
273 | |
|
|
274 | =item on_motion_notify $term, $event |
|
|
275 | |
|
|
276 | Called whenever the corresponding X event is received for the terminal If |
|
|
277 | the hook returns true, then the even will be ignored by rxvt-unicode. |
|
|
278 | |
|
|
279 | The event is a hash with most values as named by Xlib (see the XEvent |
|
|
280 | manpage), with the additional members C<row> and C<col>, which are the row |
|
|
281 | and column under the mouse cursor. |
|
|
282 | |
|
|
283 | C<on_key_press> additionally receives the string rxvt-unicode would |
|
|
284 | output, if any, in locale-specific encoding. |
|
|
285 | |
|
|
286 | subwindow. |
|
|
287 | |
263 | =back |
288 | =back |
264 | |
289 | |
265 | =head2 Variables in the C<urxvt> Package |
290 | =head2 Variables in the C<urxvt> Package |
266 | |
291 | |
267 | =over 4 |
292 | =over 4 |
… | |
… | |
274 | =back |
299 | =back |
275 | |
300 | |
276 | =head2 Functions in the C<urxvt> Package |
301 | =head2 Functions in the C<urxvt> Package |
277 | |
302 | |
278 | =over 4 |
303 | =over 4 |
|
|
304 | |
|
|
305 | =item $term = new urxvt [arg...] |
|
|
306 | |
|
|
307 | Creates a new terminal, very similar as if you had started it with |
|
|
308 | C<system $binfile, arg...>. Croaks (and probably outputs an error message) |
|
|
309 | if the new instance couldn't be created. Returns C<undef> if the new |
|
|
310 | instance didn't initialise perl, and the terminal object otherwise. The |
|
|
311 | C<init> and C<start> hooks will be called during the call. |
279 | |
312 | |
280 | =item urxvt::fatal $errormessage |
313 | =item urxvt::fatal $errormessage |
281 | |
314 | |
282 | Fatally aborts execution with the given error message. Avoid at all |
315 | Fatally aborts execution with the given error message. Avoid at all |
283 | costs! The only time this is acceptable is when the terminal process |
316 | costs! The only time this is acceptable is when the terminal process |
… | |
… | |
432 | my $htype = shift; |
465 | my $htype = shift; |
433 | |
466 | |
434 | if ($htype == 0) { # INIT |
467 | if ($htype == 0) { # INIT |
435 | my @dirs = ((split /:/, $TERM->resource ("perl_lib")), "$LIBDIR/perl"); |
468 | my @dirs = ((split /:/, $TERM->resource ("perl_lib")), "$LIBDIR/perl"); |
436 | |
469 | |
437 | for my $ext (map { split /:/, $TERM->resource ("perl_ext_$_") } 1, 2) { |
470 | for my $ext (map { split /,/, $TERM->resource ("perl_ext_$_") } 1, 2) { |
438 | my @files = grep -f $_, map "$_/$ext", @dirs; |
471 | my @files = grep -f $_, map "$_/$ext", @dirs; |
439 | |
472 | |
440 | if (@files) { |
473 | if (@files) { |
441 | register_package script_package $files[0]; |
474 | register_package script_package $files[0]; |
442 | } else { |
475 | } else { |
… | |
… | |
500 | } |
533 | } |
501 | |
534 | |
502 | =head2 The C<urxvt::term> Class |
535 | =head2 The C<urxvt::term> Class |
503 | |
536 | |
504 | =over 4 |
537 | =over 4 |
|
|
538 | |
|
|
539 | =item $term->destroy |
|
|
540 | |
|
|
541 | Destroy the terminal object (close the window, free resources etc.). |
505 | |
542 | |
506 | =item $value = $term->resource ($name[, $newval]) |
543 | =item $value = $term->resource ($name[, $newval]) |
507 | |
544 | |
508 | Returns the current resource value associated with a given name and |
545 | Returns the current resource value associated with a given name and |
509 | optionally sets a new value. Setting values is most useful in the C<init> |
546 | optionally sets a new value. Setting values is most useful in the C<init> |
… | |
… | |
626 | |
663 | |
627 | If hidden, display the overlay again. |
664 | If hidden, display the overlay again. |
628 | |
665 | |
629 | =back |
666 | =back |
630 | |
667 | |
631 | =item $cellwidth = $term->strwidth $string |
668 | =item $cellwidth = $term->strwidth ($string) |
632 | |
669 | |
633 | Returns the number of screen-cells this string would need. Correctly |
670 | Returns the number of screen-cells this string would need. Correctly |
634 | accounts for wide and combining characters. |
671 | accounts for wide and combining characters. |
635 | |
672 | |
636 | =item $octets = $term->locale_encode $string |
673 | =item $octets = $term->locale_encode ($string) |
637 | |
674 | |
638 | Convert the given text string into the corresponding locale encoding. |
675 | Convert the given text string into the corresponding locale encoding. |
639 | |
676 | |
640 | =item $string = $term->locale_decode $octets |
677 | =item $string = $term->locale_decode ($octets) |
641 | |
678 | |
642 | Convert the given locale-encoded octets into a perl string. |
679 | Convert the given locale-encoded octets into a perl string. |
643 | |
680 | |
644 | =item $term->scr_add_lines ($string) |
681 | =item $term->scr_add_lines ($string) |
645 | |
682 | |
… | |
… | |
650 | |
687 | |
651 | Normally its not a good idea to use this function, as programs might be |
688 | Normally its not a good idea to use this function, as programs might be |
652 | confused by changes in cursor position or scrolling. Its useful inside a |
689 | confused by changes in cursor position or scrolling. Its useful inside a |
653 | C<on_add_lines> hook, though. |
690 | C<on_add_lines> hook, though. |
654 | |
691 | |
|
|
692 | =item $term->cmd_parse ($octets) |
|
|
693 | |
|
|
694 | Similar to C<scr_add_lines>, but the argument must be in the |
|
|
695 | locale-specific encoding of the terminal and can contain command sequences |
|
|
696 | (escape codes) that will be interpreted. |
|
|
697 | |
655 | =item $term->tt_write ($octets) |
698 | =item $term->tt_write ($octets) |
656 | |
699 | |
657 | Write the octets given in C<$data> to the tty (i.e. as program input). To |
700 | Write the octets given in C<$data> to the tty (i.e. as program input). To |
658 | pass characters instead of octets, you should convert your strings first |
701 | pass characters instead of octets, you should convert your strings first |
659 | to the locale-specific encoding using C<< $term->locale_encode >>. |
702 | to the locale-specific encoding using C<< $term->locale_encode >>. |
|
|
703 | |
|
|
704 | =item $windowid = $term->parent |
|
|
705 | |
|
|
706 | Return the window id of the toplevel window. |
|
|
707 | |
|
|
708 | =item $windowid = $term->vt |
|
|
709 | |
|
|
710 | Return the window id of the terminal window. |
660 | |
711 | |
661 | =item $window_width = $term->width |
712 | =item $window_width = $term->width |
662 | |
713 | |
663 | =item $window_height = $term->height |
714 | =item $window_height = $term->height |
664 | |
715 | |