… | |
… | |
84 | |
84 | |
85 | Displays a digital clock using the built-in overlay. |
85 | Displays a digital clock using the built-in overlay. |
86 | |
86 | |
87 | =item mark-urls |
87 | =item mark-urls |
88 | |
88 | |
89 | Uses per-line display filtering (C<on_line_update>) to underline urls. |
89 | Uses per-line display filtering (C<on_line_update>) to underline urls and |
|
|
90 | make them clickable. When middle-clicked, the program specified in the |
|
|
91 | resource C<urlLauncher> (default C<x-www-browser>) will be started. |
90 | |
92 | |
91 | =item block-graphics-to-ascii |
93 | =item block-graphics-to-ascii |
92 | |
94 | |
93 | A not very useful example of filtering all text output to the terminal, |
95 | A not very useful example of filtering all text output to the terminal, |
94 | by replacing all line-drawing characters (U+2500 .. U+259F) by a |
96 | by replacing all line-drawing characters (U+2500 .. U+259F) by a |
… | |
… | |
123 | =over 4 |
125 | =over 4 |
124 | |
126 | |
125 | =item $text |
127 | =item $text |
126 | |
128 | |
127 | Rxvt-unicodes special way of encoding text, where one "unicode" character |
129 | Rxvt-unicodes special way of encoding text, where one "unicode" character |
128 | always represents one screen cell. See L<row_t> for a discussion of this format. |
130 | always represents one screen cell. See L<ROW_t> for a discussion of this format. |
129 | |
131 | |
130 | =item $string |
132 | =item $string |
131 | |
133 | |
132 | A perl text string, with an emphasis on I<text>. It can store all unicode |
134 | A perl text string, with an emphasis on I<text>. It can store all unicode |
133 | characters and is to be distinguished with text encoded in a specific |
135 | characters and is to be distinguished with text encoded in a specific |
… | |
… | |
228 | =item on_sel_extend $term |
230 | =item on_sel_extend $term |
229 | |
231 | |
230 | Called whenever the user tries to extend the selection (e.g. with a double |
232 | Called whenever the user tries to extend the selection (e.g. with a double |
231 | click) and is either supposed to return false (normal operation), or |
233 | click) and is either supposed to return false (normal operation), or |
232 | should extend the selection itelf and return true to suppress the built-in |
234 | should extend the selection itelf and return true to suppress the built-in |
233 | processing. |
235 | processing. This can happen multiple times, as long as the callback |
|
|
236 | returns true, it will be called on every further click by the user and is |
|
|
237 | supposed to enlarge the selection more and more, if possible. |
234 | |
238 | |
235 | See the F<selection> example extension. |
239 | See the F<selection> example extension. |
236 | |
240 | |
237 | =item on_view_change $term, $offset |
241 | =item on_view_change $term, $offset |
238 | |
242 | |
… | |
… | |
385 | |
389 | |
386 | =item $urxvt::TERM |
390 | =item $urxvt::TERM |
387 | |
391 | |
388 | The current terminal. This variable stores the current C<urxvt::term> |
392 | The current terminal. This variable stores the current C<urxvt::term> |
389 | object, whenever a callback/hook is executing. |
393 | object, whenever a callback/hook is executing. |
390 | |
|
|
391 | =item |
|
|
392 | |
394 | |
393 | =back |
395 | =back |
394 | |
396 | |
395 | =head2 Functions in the C<urxvt> Package |
397 | =head2 Functions in the C<urxvt> Package |
396 | |
398 | |
… | |
… | |
496 | $msg .= "\n" |
498 | $msg .= "\n" |
497 | unless $msg =~ /\n$/; |
499 | unless $msg =~ /\n$/; |
498 | urxvt::warn ($msg); |
500 | urxvt::warn ($msg); |
499 | }; |
501 | }; |
500 | |
502 | |
|
|
503 | # %ENV is the original startup environment |
501 | delete $ENV{IFS}; |
504 | delete $ENV{IFS}; |
502 | delete $ENV{CDPATH}; |
505 | delete $ENV{CDPATH}; |
503 | delete $ENV{BASH_ENV}; |
506 | delete $ENV{BASH_ENV}; |
504 | $ENV{PATH} = "/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/opt/bin:/opt/sbin"; |
507 | $ENV{PATH} = "/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/opt/bin:/opt/sbin"; |
505 | } |
508 | } |
… | |
… | |
594 | if ($@) { |
597 | if ($@) { |
595 | $TERM->ungrab; # better to lose the grab than the session |
598 | $TERM->ungrab; # better to lose the grab than the session |
596 | warn $@; |
599 | warn $@; |
597 | } |
600 | } |
598 | } |
601 | } |
|
|
602 | |
|
|
603 | verbose 11, "$HOOKNAME[$htype] returning <$retval>" |
|
|
604 | if $verbosity >= 11; |
599 | } |
605 | } |
600 | |
606 | |
601 | if ($htype == 1) { # DESTROY |
607 | if ($htype == 1) { # DESTROY |
602 | if (my $hook = delete $TERM->{_hook}) { |
608 | if (my $hook = delete $TERM->{_hook}) { |
603 | for my $htype (0..$#$hook) { |
609 | for my $htype (0..$#$hook) { |
… | |
… | |
612 | # clear package |
618 | # clear package |
613 | %$TERM = (); |
619 | %$TERM = (); |
614 | } |
620 | } |
615 | |
621 | |
616 | $retval |
622 | $retval |
|
|
623 | } |
|
|
624 | |
|
|
625 | sub exec_async(@) { |
|
|
626 | my $pid = fork; |
|
|
627 | |
|
|
628 | return |
|
|
629 | if !defined $pid or $pid; |
|
|
630 | |
|
|
631 | %ENV = %{ $TERM->env }; |
|
|
632 | |
|
|
633 | exec @_; |
|
|
634 | _exit 255; |
617 | } |
635 | } |
618 | |
636 | |
619 | # urxvt::term::extension |
637 | # urxvt::term::extension |
620 | |
638 | |
621 | package urxvt::term::extension; |
639 | package urxvt::term::extension; |
… | |
… | |
782 | } |
800 | } |
783 | |
801 | |
784 | =item $term = new urxvt::term $envhashref, $rxvtname, [arg...] |
802 | =item $term = new urxvt::term $envhashref, $rxvtname, [arg...] |
785 | |
803 | |
786 | Creates a new terminal, very similar as if you had started it with system |
804 | Creates a new terminal, very similar as if you had started it with system |
787 | C<$rxvtname, arg...>. C<$envhashref> must be a reference to a %ENV>-like |
805 | C<$rxvtname, arg...>. C<$envhashref> must be a reference to a C<%ENV>-like |
788 | C<hash which defines the environment of the new terminal. |
806 | hash which defines the environment of the new terminal. |
789 | |
807 | |
790 | Croaks (and probably outputs an error message) if the new instance |
808 | Croaks (and probably outputs an error message) if the new instance |
791 | couldn't be created. Returns C<undef> if the new instance didn't |
809 | couldn't be created. Returns C<undef> if the new instance didn't |
792 | initialise perl, and the terminal object otherwise. The C<init> and |
810 | initialise perl, and the terminal object otherwise. The C<init> and |
793 | C<start> hooks will be called during this call. |
811 | C<start> hooks will be called during this call. |
… | |
… | |
862 | my ($self, $name) = (shift, shift); |
880 | my ($self, $name) = (shift, shift); |
863 | unshift @_, $self, $name, ($name =~ s/\s*\+\s*(\d+)$// ? $1 : 0); |
881 | unshift @_, $self, $name, ($name =~ s/\s*\+\s*(\d+)$// ? $1 : 0); |
864 | &urxvt::term::_resource |
882 | &urxvt::term::_resource |
865 | } |
883 | } |
866 | |
884 | |
|
|
885 | =item $value = $term->x_resource ($pattern) |
|
|
886 | |
|
|
887 | Returns the X-Resource for the given pattern, excluding the program or |
|
|
888 | class name, i.e. C<< $term->x_resource ("boldFont") >> should return the |
|
|
889 | same value as used by this instance of rxvt-unicode. Returns C<undef> if no |
|
|
890 | resource with that pattern exists. |
|
|
891 | |
|
|
892 | This method should only be called during the C<on_start> hook, as there is |
|
|
893 | only one resource database per display, and later invocations might return |
|
|
894 | the wrong resources. |
|
|
895 | |
867 | =item $success = $term->parse_keysym ($keysym_spec, $command_string) |
896 | =item $success = $term->parse_keysym ($keysym_spec, $command_string) |
868 | |
897 | |
869 | Adds a keymap translation exactly as specified via a resource. See the |
898 | Adds a keymap translation exactly as specified via a resource. See the |
870 | C<keysym> resource in the @@RXVT_NAME@@(1) manpage. |
899 | C<keysym> resource in the @@RXVT_NAME@@(1) manpage. |
871 | |
900 | |
… | |
… | |
1194 | Return the row number of the first/last row of the line, respectively. |
1223 | Return the row number of the first/last row of the line, respectively. |
1195 | |
1224 | |
1196 | =item $offset = $line->offset_of ($row, $col) |
1225 | =item $offset = $line->offset_of ($row, $col) |
1197 | |
1226 | |
1198 | Returns the character offset of the given row|col pair within the logical |
1227 | Returns the character offset of the given row|col pair within the logical |
1199 | line. |
1228 | line. Works for rows outside the line, too, and returns corresponding |
|
|
1229 | offsets outside the string. |
1200 | |
1230 | |
1201 | =item ($row, $col) = $line->coord_of ($offset) |
1231 | =item ($row, $col) = $line->coord_of ($offset) |
1202 | |
1232 | |
1203 | Translates a string offset into terminal coordinates again. |
1233 | Translates a string offset into terminal coordinates again. |
1204 | |
1234 | |
… | |
… | |
1441 | my ($self) = @_; |
1471 | my ($self) = @_; |
1442 | |
1472 | |
1443 | delete $self->{term}{_destroy}{$self}; |
1473 | delete $self->{term}{_destroy}{$self}; |
1444 | $self->{term}->ungrab; |
1474 | $self->{term}->ungrab; |
1445 | } |
1475 | } |
|
|
1476 | |
|
|
1477 | =back |
1446 | |
1478 | |
1447 | =head2 The C<urxvt::timer> Class |
1479 | =head2 The C<urxvt::timer> Class |
1448 | |
1480 | |
1449 | This class implements timer watchers/events. Time is represented as a |
1481 | This class implements timer watchers/events. Time is represented as a |
1450 | fractional number of seconds since the epoch. Example: |
1482 | fractional number of seconds since the epoch. Example: |
… | |
… | |
1557 | |
1589 | |
1558 | =item == 0 - fatal messages |
1590 | =item == 0 - fatal messages |
1559 | |
1591 | |
1560 | =item >= 3 - script loading and management |
1592 | =item >= 3 - script loading and management |
1561 | |
1593 | |
1562 | =item >=10 - all events received |
1594 | =item >=10 - all called hooks |
|
|
1595 | |
|
|
1596 | =item >=11 - hook reutrn values |
1563 | |
1597 | |
1564 | =back |
1598 | =back |
1565 | |
1599 | |
1566 | =head1 AUTHOR |
1600 | =head1 AUTHOR |
1567 | |
1601 | |