… | |
… | |
4 | |
4 | |
5 | urxvtperl - rxvt-unicode's embedded perl interpreter |
5 | urxvtperl - rxvt-unicode's embedded perl interpreter |
6 | |
6 | |
7 | =head1 SYNOPSIS |
7 | =head1 SYNOPSIS |
8 | |
8 | |
9 | # create a file grab_test in $HOME: |
9 | # create a file grab_test in some directory: |
10 | |
10 | |
11 | sub on_sel_grab { |
11 | sub on_sel_grab { |
12 | warn "you selected ", $_[0]->selection; |
12 | warn "you selected ", $_[0]->selection; |
13 | () |
13 | () |
14 | } |
14 | } |
15 | |
15 | |
16 | # start a urxvt using it: |
16 | # start a urxvt instance using it: |
17 | |
17 | |
18 | urxvt --perl-lib $HOME -pe grab_test |
18 | urxvt --perl-lib path/to/somedirectory -pe grab_test |
19 | |
19 | |
20 | =head1 DESCRIPTION |
20 | =head1 DESCRIPTION |
21 | |
21 | |
22 | Every time a terminal object gets created, extension scripts specified via |
22 | Every time a terminal object gets created, extension scripts specified via |
23 | the C<perl> resource are loaded and associated with it. |
23 | the C<perl> resource are loaded and associated with it. |
… | |
… | |
45 | |
45 | |
46 | URxvt.perl-ext-common: default,selection-autotransform |
46 | URxvt.perl-ext-common: default,selection-autotransform |
47 | |
47 | |
48 | Extensions may add additional resources and C<actions>, i.e., methods |
48 | Extensions may add additional resources and C<actions>, i.e., methods |
49 | which can be bound to a key and invoked by the user. An extension can |
49 | which can be bound to a key and invoked by the user. An extension can |
50 | define the resources it support and also default bindings for one or |
50 | define the resources it support using so called META comments, |
51 | more actions it provides using so called META comments, described |
|
|
52 | below. Similarly to builtin resources, extension resources can also be |
51 | described below. Similarly to builtin resources, extension resources |
53 | specified on the command line as long options (with C<.> replaced by |
52 | can also be specified on the command line as long options (with C<.> |
54 | C<->), in which case the corresponding extension is loaded |
53 | replaced by C<->), in which case the corresponding extension is loaded |
55 | automatically. For this to work the extension B<must> define META |
54 | automatically. For this to work the extension B<must> define META |
56 | comments for its resources. |
55 | comments for its resources. |
57 | |
56 | |
58 | =head1 API DOCUMENTATION |
57 | =head1 API DOCUMENTATION |
59 | |
58 | |
… | |
… | |
71 | terminal is destroyed. |
70 | terminal is destroyed. |
72 | |
71 | |
73 | Argument names also often indicate the type of a parameter. Here are some |
72 | Argument names also often indicate the type of a parameter. Here are some |
74 | hints on what they mean: |
73 | hints on what they mean: |
75 | |
74 | |
76 | =over 4 |
75 | =over |
77 | |
76 | |
78 | =item $text |
77 | =item $text |
79 | |
78 | |
80 | Rxvt-unicode's special way of encoding text, where one "unicode" character |
79 | Rxvt-unicode's special way of encoding text, where one "unicode" character |
81 | always represents one screen cell. See L<ROW_t> for a discussion of this format. |
80 | always represents one screen cell. See L<ROW_t> for a discussion of this format. |
… | |
… | |
116 | the C<urxvt::extension> section below. |
115 | the C<urxvt::extension> section below. |
117 | |
116 | |
118 | =head2 META comments |
117 | =head2 META comments |
119 | |
118 | |
120 | Rxvt-unicode recognizes special meta comments in extensions that define |
119 | Rxvt-unicode recognizes special meta comments in extensions that define |
121 | different types of metadata. |
120 | different types of metadata. These comments are scanned whenever a |
|
|
121 | terminal is created and are typically used to autoload extensions when |
|
|
122 | their resources or command line parameters are used. |
122 | |
123 | |
123 | Currently, it recxognises only one such comment: |
124 | Currently, it recognises only one such comment: |
124 | |
125 | |
125 | =over 4 |
126 | =over |
126 | |
127 | |
127 | =item #:META:RESOURCE:name:type:desc |
128 | =item #:META:RESOURCE:name:type:desc |
128 | |
129 | |
129 | The RESOURCE comment defines a resource used by the extension, where |
130 | The RESOURCE comment defines a resource used by the extension, where |
130 | C<name> is the resource name, C<type> is the resource type, C<boolean> |
131 | C<name> is the resource name, C<type> is the resource type, C<boolean> |
131 | or C<string>, and C<desc> is the resource description. |
132 | or C<string>, and C<desc> is the resource description. |
132 | |
133 | |
|
|
134 | The extension will be autoloaded when this resource is specified or used |
|
|
135 | as a command line parameter. |
|
|
136 | |
133 | =back |
137 | =back |
134 | |
138 | |
135 | =head2 Hooks |
139 | =head2 Hooks |
136 | |
140 | |
137 | The following subroutines can be declared in extension files, and will be |
141 | The following subroutines can be declared in extension files, and will be |
… | |
… | |
144 | hooks returns true, then the event counts as being I<consumed>, and the |
148 | hooks returns true, then the event counts as being I<consumed>, and the |
145 | relevant action might not be carried out by the C++ code. |
149 | relevant action might not be carried out by the C++ code. |
146 | |
150 | |
147 | I<< When in doubt, return a false value (preferably C<()>). >> |
151 | I<< When in doubt, return a false value (preferably C<()>). >> |
148 | |
152 | |
149 | =over 4 |
153 | =over |
150 | |
154 | |
151 | =item on_init $term |
155 | =item on_init $term |
152 | |
156 | |
153 | Called after a new terminal object has been initialized, but before |
157 | Called after a new terminal object has been initialized, but before |
154 | windows are created or the command gets run. Most methods are unsafe to |
158 | windows are created or the command gets run. Most methods are unsafe to |
… | |
… | |
418 | |
422 | |
419 | our $NOCHAR = chr 0xffff; |
423 | our $NOCHAR = chr 0xffff; |
420 | |
424 | |
421 | =head2 Variables in the C<urxvt> Package |
425 | =head2 Variables in the C<urxvt> Package |
422 | |
426 | |
423 | =over 4 |
427 | =over |
424 | |
428 | |
425 | =item $urxvt::LIBDIR |
429 | =item $urxvt::LIBDIR |
426 | |
430 | |
427 | The rxvt-unicode library directory, where, among other things, the perl |
431 | The rxvt-unicode library directory, where, among other things, the perl |
428 | modules and scripts are stored. |
432 | modules and scripts are stored. |
… | |
… | |
458 | |
462 | |
459 | =back |
463 | =back |
460 | |
464 | |
461 | =head2 Functions in the C<urxvt> Package |
465 | =head2 Functions in the C<urxvt> Package |
462 | |
466 | |
463 | =over 4 |
467 | =over |
464 | |
468 | |
465 | =item urxvt::fatal $errormessage |
469 | =item urxvt::fatal $errormessage |
466 | |
470 | |
467 | Fatally aborts execution with the given error message (which should |
471 | Fatally aborts execution with the given error message (which should |
468 | include a trailing newline). Avoid at all costs! The only time this |
472 | include a trailing newline). Avoid at all costs! The only time this |
… | |
… | |
513 | CirculateRequest, PropertyNotify, SelectionClear, SelectionRequest, |
517 | CirculateRequest, PropertyNotify, SelectionClear, SelectionRequest, |
514 | SelectionNotify, ColormapNotify, ClientMessage, MappingNotify |
518 | SelectionNotify, ColormapNotify, ClientMessage, MappingNotify |
515 | |
519 | |
516 | Various constants for use in X calls and event processing. |
520 | Various constants for use in X calls and event processing. |
517 | |
521 | |
|
|
522 | =item urxvt::PrivMode_132, PrivMode_132OK, PrivMode_rVideo, PrivMode_relOrigin, |
|
|
523 | PrivMode_Screen, PrivMode_Autowrap, PrivMode_aplCUR, PrivMode_aplKP, |
|
|
524 | PrivMode_HaveBackSpace, PrivMode_BackSpace, PrivMode_ShiftKeys, |
|
|
525 | PrivMode_VisibleCursor, PrivMode_MouseX10, PrivMode_MouseX11, |
|
|
526 | PrivMode_scrollBar, PrivMode_TtyOutputInh, PrivMode_Keypress, |
|
|
527 | PrivMode_smoothScroll, PrivMode_vt52, PrivMode_LFNL, PrivMode_MouseBtnEvent, |
|
|
528 | PrivMode_MouseAnyEvent, PrivMode_BracketPaste, PrivMode_ExtMouseUTF8, |
|
|
529 | PrivMode_ExtMouseUrxvt, PrivMode_BlinkingCursor, PrivMode_mouse_report, |
|
|
530 | PrivMode_Default |
|
|
531 | |
|
|
532 | Constants for checking DEC private modes. |
|
|
533 | |
518 | =back |
534 | =back |
519 | |
535 | |
520 | =head2 RENDITION |
536 | =head2 RENDITION |
521 | |
537 | |
522 | Rendition bitsets contain information about colour, font, font styles and |
538 | Rendition bitsets contain information about colour, font, font styles and |
… | |
… | |
525 | The following "macros" deal with changes in rendition sets. You should |
541 | The following "macros" deal with changes in rendition sets. You should |
526 | never just create a bitset, you should always modify an existing one, |
542 | never just create a bitset, you should always modify an existing one, |
527 | as they contain important information required for correct operation of |
543 | as they contain important information required for correct operation of |
528 | rxvt-unicode. |
544 | rxvt-unicode. |
529 | |
545 | |
530 | =over 4 |
546 | =over |
531 | |
547 | |
532 | =item $rend = urxvt::DEFAULT_RSTYLE |
548 | =item $rend = urxvt::DEFAULT_RSTYLE |
533 | |
549 | |
534 | Returns the default rendition, as used when the terminal is starting up or |
550 | Returns the default rendition, as used when the terminal is starting up or |
535 | being reset. Useful as a base to start when creating renditions. |
551 | being reset. Useful as a base to start when creating renditions. |
… | |
… | |
589 | sub parse_resource { |
605 | sub parse_resource { |
590 | my ($term, $name, $isarg, $longopt, $flag, $value) = @_; |
606 | my ($term, $name, $isarg, $longopt, $flag, $value) = @_; |
591 | |
607 | |
592 | $term->scan_extensions; |
608 | $term->scan_extensions; |
593 | |
609 | |
|
|
610 | # iterating over all resources has quadratic time overhead |
|
|
611 | # overall, maybe this could be optimised? |
594 | my $r = $term->{meta}{resource}; |
612 | my $r = $term->{meta}{resource}; |
595 | keys %$r; # reset iterator |
613 | keys %$r; # reset iterator |
596 | while (my ($k, $v) = each %$r) { |
614 | while (my ($k, $v) = each %$r) { |
597 | my $pattern = $k; |
615 | my $pattern = $k; |
598 | $pattern =~ y/./-/ if $isarg; |
616 | $pattern =~ y/./-/ if $isarg; |
… | |
… | |
605 | if ($pattern eq $prefix) { |
623 | if ($pattern eq $prefix) { |
606 | $name = "$urxvt::RESCLASS.$k$suffix"; |
624 | $name = "$urxvt::RESCLASS.$k$suffix"; |
607 | |
625 | |
608 | push @{ $term->{perl_ext_3} }, $v->[0]; |
626 | push @{ $term->{perl_ext_3} }, $v->[0]; |
609 | |
627 | |
|
|
628 | return 1 unless $isarg; |
|
|
629 | |
610 | if ($v->[1] eq "boolean") { |
630 | if ($v->[1] eq "boolean") { |
611 | $term->put_option_db ($name, $flag ? "true" : "false"); |
631 | $term->put_option_db ($name, $flag ? "true" : "false"); |
612 | return 1; |
632 | return 1; |
613 | } else { |
633 | } else { |
614 | $term->put_option_db ($name, $value); |
634 | $term->put_option_db ($name, $value); |
… | |
… | |
709 | @TERM_EXT = (); |
729 | @TERM_EXT = (); |
710 | $TERM->register_package ($_) for @pkg; |
730 | $TERM->register_package ($_) for @pkg; |
711 | } |
731 | } |
712 | |
732 | |
713 | for ( |
733 | for ( |
|
|
734 | @{ delete $TERM->{perl_ext_3} }, |
714 | (grep $_, map { split /,/, $TERM->resource ("perl_ext_$_") } 1, 2), |
735 | (grep $_, map { split /,/, $TERM->resource ("perl_ext_$_") } 1, 2), |
715 | @{ delete $TERM->{perl_ext_3} } |
|
|
716 | ) { |
736 | ) { |
717 | if ($_ eq "default") { |
737 | if ($_ eq "default") { |
718 | |
738 | |
719 | $ext_arg{$_} = [] |
739 | $ext_arg{$_} = [] |
720 | for qw(selection option-popup selection-popup readline searchable-scrollback); |
740 | for qw(selection option-popup selection-popup readline searchable-scrollback confirm-paste); |
721 | |
741 | |
722 | for ($TERM->_keysym_resources) { |
742 | for ($TERM->_keysym_resources) { |
723 | next if /^(?:string|command|builtin|builtin-string|perl)/; |
743 | next if /^(?:string|command|builtin|builtin-string|perl)/; |
724 | next unless /^([A-Za-z0-9_\-]+):/; |
744 | next unless /^([A-Za-z0-9_\-]+):/; |
725 | |
745 | |
… | |
… | |
838 | |
858 | |
839 | The methods (And data members) documented below can be called on extension |
859 | The methods (And data members) documented below can be called on extension |
840 | objects, in addition to call methods documented for the <urxvt::term> |
860 | objects, in addition to call methods documented for the <urxvt::term> |
841 | class. |
861 | class. |
842 | |
862 | |
843 | =over 4 |
863 | =over |
844 | |
864 | |
845 | =item $urxvt_term = $self->{term} |
865 | =item $urxvt_term = $self->{term} |
846 | |
866 | |
847 | Returns the C<urxvt::term> object associated with this instance of the |
867 | Returns the C<urxvt::term> object associated with this instance of the |
848 | extension. This member I<must not> be changed in any way. |
868 | extension. This member I<must not> be changed in any way. |
… | |
… | |
1089 | |
1109 | |
1090 | package urxvt::term; |
1110 | package urxvt::term; |
1091 | |
1111 | |
1092 | =head2 The C<urxvt::term> Class |
1112 | =head2 The C<urxvt::term> Class |
1093 | |
1113 | |
1094 | =over 4 |
1114 | =over |
1095 | |
1115 | |
1096 | =cut |
1116 | =cut |
1097 | |
1117 | |
1098 | # find on_xxx subs in the package and register them |
1118 | # find on_xxx subs in the package and register them |
1099 | # as hooks |
1119 | # as hooks |
… | |
… | |
1134 | sub scan_extensions { |
1154 | sub scan_extensions { |
1135 | my ($self) = @_; |
1155 | my ($self) = @_; |
1136 | |
1156 | |
1137 | return if exists $self->{meta}; |
1157 | return if exists $self->{meta}; |
1138 | |
1158 | |
1139 | my @libdirs = perl_libdirs $self; |
1159 | my @urxvtdirs = perl_libdirs $self; |
|
|
1160 | # my @cpandirs = grep -d, map "$_/URxvt/Ext", @INC; |
1140 | |
1161 | |
1141 | # return if $self->{meta_libdirs} eq join "\x00", @libdirs;#d# |
|
|
1142 | |
|
|
1143 | # $self->{meta_libdirs} = join "\x00", @libdirs;#d# |
|
|
1144 | $self->{meta} = \my %meta; |
1162 | $self->{meta} = \my %meta; |
1145 | |
1163 | |
1146 | # first gather extensions |
1164 | # first gather extensions |
1147 | for my $dir (reverse @libdirs) { |
1165 | |
|
|
1166 | my $gather = sub { |
|
|
1167 | my ($dir, $core) = @_; |
|
|
1168 | |
1148 | opendir my $fh, $dir |
1169 | opendir my $fh, $dir |
1149 | or next; |
1170 | or return; |
|
|
1171 | |
1150 | for my $ext (readdir $fh) { |
1172 | for my $ext (readdir $fh) { |
1151 | $ext !~ /^\./ |
1173 | $ext !~ /^\./ |
|
|
1174 | or next; |
|
|
1175 | |
1152 | and open my $fh, "<", "$dir/$ext" |
1176 | open my $fh, "<", "$dir/$ext" |
|
|
1177 | or next; |
|
|
1178 | |
|
|
1179 | -f $fh |
|
|
1180 | or next; |
|
|
1181 | |
|
|
1182 | $ext =~ s/\.uext$// or $core |
1153 | or next; |
1183 | or next; |
1154 | |
1184 | |
1155 | my %ext = (dir => $dir); |
1185 | my %ext = (dir => $dir); |
1156 | |
1186 | |
1157 | while (<$fh>) { |
1187 | while (<$fh>) { |
… | |
… | |
1170 | } |
1200 | } |
1171 | } |
1201 | } |
1172 | |
1202 | |
1173 | $meta{ext}{$ext} = \%ext; |
1203 | $meta{ext}{$ext} = \%ext; |
1174 | } |
1204 | } |
1175 | } |
1205 | }; |
|
|
1206 | |
|
|
1207 | # $gather->($_, 0) for @cpandirs; |
|
|
1208 | $gather->($_, 1) for @urxvtdirs; |
1176 | |
1209 | |
1177 | # and now merge resources |
1210 | # and now merge resources |
|
|
1211 | |
|
|
1212 | $meta{resource} = \my %resource; |
|
|
1213 | |
1178 | while (my ($k, $v) = each %{ $meta{ext} }) { |
1214 | while (my ($k, $v) = each %{ $meta{ext} }) { |
1179 | #TODO: should check for extensions overriding each other |
1215 | #TODO: should check for extensions overriding each other |
1180 | %{ $meta{resource} } = (%{ $meta{resource} }, %{ $v->{resource} }); |
1216 | %resource = (%resource, %{ $v->{resource} }); |
1181 | } |
1217 | } |
1182 | } |
1218 | } |
1183 | |
1219 | |
1184 | =item $term = new urxvt::term $envhashref, $rxvtname, [arg...] |
1220 | =item $term = new urxvt::term $envhashref, $rxvtname, [arg...] |
1185 | |
1221 | |
… | |
… | |
1248 | insecure intensityStyles iso14755 iso14755_52 jumpScroll loginShell |
1284 | insecure intensityStyles iso14755 iso14755_52 jumpScroll loginShell |
1249 | mapAlert meta8 mouseWheelScrollPage override_redirect pastableTabs |
1285 | mapAlert meta8 mouseWheelScrollPage override_redirect pastableTabs |
1250 | pointerBlank reverseVideo scrollBar scrollBar_floating scrollBar_right |
1286 | pointerBlank reverseVideo scrollBar scrollBar_floating scrollBar_right |
1251 | scrollTtyKeypress scrollTtyOutput scrollWithBuffer secondaryScreen |
1287 | scrollTtyKeypress scrollTtyOutput scrollWithBuffer secondaryScreen |
1252 | secondaryScroll skipBuiltinGlyphs skipScroll transparent tripleclickwords |
1288 | secondaryScroll skipBuiltinGlyphs skipScroll transparent tripleclickwords |
1253 | urgentOnBell utmpInhibit visualBell |
1289 | urgentOnBell utmpInhibit visualBell disablePasteBrackets |
1254 | |
1290 | |
1255 | =item $value = $term->resource ($name[, $newval]) |
1291 | =item $value = $term->resource ($name[, $newval]) |
1256 | |
1292 | |
1257 | Returns the current resource value associated with a given name and |
1293 | Returns the current resource value associated with a given name and |
1258 | optionally sets a new value. Setting values is most useful in the C<init> |
1294 | optionally sets a new value. Setting values is most useful in the C<init> |
… | |
… | |
1284 | preeditType print_pipe pty_fd reverseVideo saveLines scrollBar |
1320 | preeditType print_pipe pty_fd reverseVideo saveLines scrollBar |
1285 | scrollBar_align scrollBar_floating scrollBar_right scrollBar_thickness |
1321 | scrollBar_align scrollBar_floating scrollBar_right scrollBar_thickness |
1286 | scrollTtyKeypress scrollTtyOutput scrollWithBuffer scrollstyle |
1322 | scrollTtyKeypress scrollTtyOutput scrollWithBuffer scrollstyle |
1287 | secondaryScreen secondaryScroll shade skipBuiltinGlyphs skipScroll |
1323 | secondaryScreen secondaryScroll shade skipBuiltinGlyphs skipScroll |
1288 | term_name title transient_for transparent tripleclickwords urgentOnBell |
1324 | term_name title transient_for transparent tripleclickwords urgentOnBell |
1289 | utmpInhibit visualBell |
1325 | utmpInhibit visualBell rewrapMode disablePasteBrackets |
1290 | |
1326 | |
1291 | =cut |
1327 | =cut |
1292 | |
1328 | |
1293 | sub resource($$;$) { |
1329 | sub resource($$;$) { |
1294 | my ($self, $name) = (shift, shift); |
1330 | my ($self, $name) = (shift, shift); |
… | |
… | |
1331 | my $res = &x_resource; |
1367 | my $res = &x_resource; |
1332 | |
1368 | |
1333 | $res =~ /^\s*(?:true|yes|on|1)\s*$/i ? 1 : defined $res && 0 |
1369 | $res =~ /^\s*(?:true|yes|on|1)\s*$/i ? 1 : defined $res && 0 |
1334 | } |
1370 | } |
1335 | |
1371 | |
|
|
1372 | =item $action = $term->lookup_keysym ($keysym, $state) |
|
|
1373 | |
|
|
1374 | Returns the action bound to key combination C<($keysym, $state)>, |
|
|
1375 | if a binding for it exists, and C<undef> otherwise. |
|
|
1376 | |
1336 | =item $success = $term->bind_action ($key, $action) |
1377 | =item $success = $term->bind_action ($key, $action) |
1337 | |
1378 | |
1338 | Adds a key binding exactly as specified via a C<keysym> resource. See the |
1379 | Adds a key binding exactly as specified via a C<keysym> resource. See the |
1339 | C<keysym> resource in the urxvt(1) manpage. |
1380 | C<keysym> resource in the urxvt(1) manpage. |
1340 | |
1381 | |
1341 | To add default bindings for an extension, the extension should call C<< |
1382 | To add default bindings for actions, an extension should call C<< |
1342 | ->bind_action >> on it's C<init> hook for every such binding. Doing it |
1383 | ->bind_action >> in its C<init> hook for every such binding. Doing it |
1343 | in the C<init> hook allows users the override or remove the the binding |
1384 | in the C<init> hook allows users to override or remove the binding |
1344 | again. |
1385 | again. |
1345 | |
1386 | |
1346 | Example: the C<searchable-scrollback> by default binds itself |
1387 | Example: the C<searchable-scrollback> by default binds itself |
1347 | on C<Meta-s>, using C<< $self->bind_action >>, which calls C<< |
1388 | on C<Meta-s>, using C<< $self->bind_action >>, which calls C<< |
1348 | $term->bind_action >>. |
1389 | $term->bind_action >>. |
… | |
… | |
1436 | This method returns an urxvt::overlay object. The overlay will be visible |
1477 | This method returns an urxvt::overlay object. The overlay will be visible |
1437 | as long as the perl object is referenced. |
1478 | as long as the perl object is referenced. |
1438 | |
1479 | |
1439 | The methods currently supported on C<urxvt::overlay> objects are: |
1480 | The methods currently supported on C<urxvt::overlay> objects are: |
1440 | |
1481 | |
1441 | =over 4 |
1482 | =over |
1442 | |
1483 | |
1443 | =item $overlay->set ($x, $y, $text[, $rend]) |
1484 | =item $overlay->set ($x, $y, $text[, $rend]) |
1444 | |
1485 | |
1445 | Similar to C<< $term->ROW_t >> and C<< $term->ROW_r >> in that it puts |
1486 | Similar to C<< $term->ROW_t >> and C<< $term->ROW_r >> in that it puts |
1446 | text in rxvt-unicode's special encoding and an array of rendition values |
1487 | text in rxvt-unicode's special encoding and an array of rendition values |
… | |
… | |
1597 | |
1638 | |
1598 | =item $term->key_release ($state, $keycode[, $time]) |
1639 | =item $term->key_release ($state, $keycode[, $time]) |
1599 | |
1640 | |
1600 | Deliver various fake events to to terminal. |
1641 | Deliver various fake events to to terminal. |
1601 | |
1642 | |
1602 | =item $window_width = $term->width |
1643 | =item $window_width = $term->width ([$new_value]) |
1603 | |
1644 | |
1604 | =item $window_height = $term->height |
1645 | =item $window_height = $term->height ([$new_value]) |
1605 | |
1646 | |
1606 | =item $font_width = $term->fwidth |
1647 | =item $font_width = $term->fwidth ([$new_value]) |
1607 | |
1648 | |
1608 | =item $font_height = $term->fheight |
1649 | =item $font_height = $term->fheight ([$new_value]) |
1609 | |
1650 | |
1610 | =item $font_ascent = $term->fbase |
1651 | =item $font_ascent = $term->fbase ([$new_value]) |
1611 | |
1652 | |
1612 | =item $terminal_rows = $term->nrow |
1653 | =item $terminal_rows = $term->nrow ([$new_value]) |
1613 | |
1654 | |
1614 | =item $terminal_columns = $term->ncol |
1655 | =item $terminal_columns = $term->ncol ([$new_value]) |
1615 | |
1656 | |
1616 | =item $has_focus = $term->focus |
1657 | =item $has_focus = $term->focus ([$new_value]) |
1617 | |
1658 | |
1618 | =item $is_mapped = $term->mapped |
1659 | =item $is_mapped = $term->mapped ([$new_value]) |
1619 | |
1660 | |
1620 | =item $max_scrollback = $term->saveLines |
1661 | =item $max_scrollback = $term->saveLines ([$new_value]) |
1621 | |
1662 | |
1622 | =item $nrow_plus_saveLines = $term->total_rows |
1663 | =item $nrow_plus_saveLines = $term->total_rows ([$new_value]) |
1623 | |
1664 | |
1624 | =item $topmost_scrollback_row = $term->top_row |
1665 | =item $topmost_scrollback_row = $term->top_row ([$new_value]) |
1625 | |
1666 | |
1626 | Return various integers describing terminal characteristics. |
1667 | Return various integers describing terminal characteristics. If an |
|
|
1668 | argument is given, changes the value and returns the previous one. |
1627 | |
1669 | |
1628 | =item $x_display = $term->display_id |
1670 | =item $x_display = $term->display_id |
1629 | |
1671 | |
1630 | Return the DISPLAY used by rxvt-unicode. |
1672 | Return the DISPLAY used by rxvt-unicode. |
1631 | |
1673 | |
… | |
… | |
1668 | |
1710 | |
1669 | =item $cursor_is_hidden = $term->hidden_cursor |
1711 | =item $cursor_is_hidden = $term->hidden_cursor |
1670 | |
1712 | |
1671 | Returns whether the cursor is currently hidden or not. |
1713 | Returns whether the cursor is currently hidden or not. |
1672 | |
1714 | |
|
|
1715 | =item $priv_modes = $term->priv_modes |
|
|
1716 | |
|
|
1717 | Returns a bitset with the state of DEC private modes. |
|
|
1718 | |
|
|
1719 | Example: |
|
|
1720 | |
|
|
1721 | if ($term->priv_modes & urxvt::PrivMode_mouse_report) { |
|
|
1722 | # mouse reporting is turned on |
|
|
1723 | } |
|
|
1724 | |
1673 | =item $view_start = $term->view_start ([$newvalue]) |
1725 | =item $view_start = $term->view_start ([$newvalue]) |
1674 | |
1726 | |
1675 | Returns the row number of the topmost displayed line. Maximum value is |
1727 | Returns the row number of the topmost displayed line and changes it, |
1676 | C<0>, which displays the normal terminal contents. Lower values scroll |
1728 | if an argument is given. Values greater than or equal to C<0> display |
1677 | this many lines into the scrollback buffer. |
1729 | the terminal contents. Lower values scroll this many lines into the |
|
|
1730 | scrollback buffer. |
1678 | |
1731 | |
1679 | =item $term->want_refresh |
1732 | =item $term->want_refresh |
1680 | |
1733 | |
1681 | Requests a screen refresh. At the next opportunity, rxvt-unicode will |
1734 | Requests a screen refresh. At the next opportunity, rxvt-unicode will |
1682 | compare the on-screen display with its stored representation. If they |
1735 | compare the on-screen display with its stored representation. If they |
1683 | differ, it redraws the differences. |
1736 | differ, it redraws the differences. |
1684 | |
1737 | |
1685 | Used after changing terminal contents to display them. |
1738 | Used after changing terminal contents to display them. |
|
|
1739 | |
|
|
1740 | =item $term->refresh_check |
|
|
1741 | |
|
|
1742 | Checks if a refresh has been requested and, if so, schedules one. |
1686 | |
1743 | |
1687 | =item $text = $term->ROW_t ($row_number[, $new_text[, $start_col]]) |
1744 | =item $text = $term->ROW_t ($row_number[, $new_text[, $start_col]]) |
1688 | |
1745 | |
1689 | Returns the text of the entire row with number C<$row_number>. Row C<< $term->top_row >> |
1746 | Returns the text of the entire row with number C<$row_number>. Row C<< $term->top_row >> |
1690 | is the topmost terminal line, row C<< $term->nrow-1 >> is the bottommost |
1747 | is the topmost terminal line, row C<< $term->nrow-1 >> is the bottommost |
… | |
… | |
1736 | |
1793 | |
1737 | Create and return a new C<urxvt::line> object that stores information |
1794 | Create and return a new C<urxvt::line> object that stores information |
1738 | about the logical line that row C<$row_number> is part of. It supports the |
1795 | about the logical line that row C<$row_number> is part of. It supports the |
1739 | following methods: |
1796 | following methods: |
1740 | |
1797 | |
1741 | =over 4 |
1798 | =over |
1742 | |
1799 | |
1743 | =item $text = $line->t ([$new_text]) |
1800 | =item $text = $line->t ([$new_text]) |
1744 | |
1801 | |
1745 | Returns or replaces the full text of the line, similar to C<ROW_t> |
1802 | Returns or replaces the full text of the line, similar to C<ROW_t> |
1746 | |
1803 | |
… | |
… | |
1926 | |
1983 | |
1927 | package urxvt::popup; |
1984 | package urxvt::popup; |
1928 | |
1985 | |
1929 | =head2 The C<urxvt::popup> Class |
1986 | =head2 The C<urxvt::popup> Class |
1930 | |
1987 | |
1931 | =over 4 |
1988 | =over |
1932 | |
1989 | |
1933 | =cut |
1990 | =cut |
1934 | |
1991 | |
1935 | sub add_item { |
1992 | sub add_item { |
1936 | my ($self, $item) = @_; |
1993 | my ($self, $item) = @_; |
… | |
… | |
2072 | ->cb (sub { |
2129 | ->cb (sub { |
2073 | $term->{overlay}->set (0, 0, |
2130 | $term->{overlay}->set (0, 0, |
2074 | sprintf "%2d:%02d:%02d", (localtime urxvt::NOW)[2,1,0]); |
2131 | sprintf "%2d:%02d:%02d", (localtime urxvt::NOW)[2,1,0]); |
2075 | }); |
2132 | }); |
2076 | |
2133 | |
2077 | =over 4 |
2134 | =over |
2078 | |
2135 | |
2079 | =item $timer = new urxvt::timer |
2136 | =item $timer = new urxvt::timer |
2080 | |
2137 | |
2081 | Create a new timer object in started state. It is scheduled to fire |
2138 | Create a new timer object in started state. It is scheduled to fire |
2082 | immediately. |
2139 | immediately. |
… | |
… | |
2131 | sysread $term->{socket}, my $buf, 8192 |
2188 | sysread $term->{socket}, my $buf, 8192 |
2132 | or end-of-file; |
2189 | or end-of-file; |
2133 | }); |
2190 | }); |
2134 | |
2191 | |
2135 | |
2192 | |
2136 | =over 4 |
2193 | =over |
2137 | |
2194 | |
2138 | =item $iow = new urxvt::iow |
2195 | =item $iow = new urxvt::iow |
2139 | |
2196 | |
2140 | Create a new io watcher object in stopped state. |
2197 | Create a new io watcher object in stopped state. |
2141 | |
2198 | |
… | |
… | |
2168 | |
2225 | |
2169 | This class implements idle watchers, that get called automatically when |
2226 | This class implements idle watchers, that get called automatically when |
2170 | the process is idle. They should return as fast as possible, after doing |
2227 | the process is idle. They should return as fast as possible, after doing |
2171 | some useful work. |
2228 | some useful work. |
2172 | |
2229 | |
2173 | =over 4 |
2230 | =over |
2174 | |
2231 | |
2175 | =item $iw = new urxvt::iw |
2232 | =item $iw = new urxvt::iw |
2176 | |
2233 | |
2177 | Create a new idle watcher object in stopped state. |
2234 | Create a new idle watcher object in stopped state. |
2178 | |
2235 | |
… | |
… | |
2203 | ->cb (sub { |
2260 | ->cb (sub { |
2204 | my ($pw, $exit_status) = @_; |
2261 | my ($pw, $exit_status) = @_; |
2205 | ... |
2262 | ... |
2206 | }); |
2263 | }); |
2207 | |
2264 | |
2208 | =over 4 |
2265 | =over |
2209 | |
2266 | |
2210 | =item $pw = new urxvt::pw |
2267 | =item $pw = new urxvt::pw |
2211 | |
2268 | |
2212 | Create a new process watcher in stopped state. |
2269 | Create a new process watcher in stopped state. |
2213 | |
2270 | |
… | |
… | |
2230 | =head2 URXVT_PERL_VERBOSITY |
2287 | =head2 URXVT_PERL_VERBOSITY |
2231 | |
2288 | |
2232 | This variable controls the verbosity level of the perl extension. Higher |
2289 | This variable controls the verbosity level of the perl extension. Higher |
2233 | numbers indicate more verbose output. |
2290 | numbers indicate more verbose output. |
2234 | |
2291 | |
2235 | =over 4 |
2292 | =over |
2236 | |
2293 | |
2237 | =item == 0 - fatal messages |
2294 | =item == 0 - fatal messages |
2238 | |
2295 | |
2239 | =item >= 3 - script loading and management |
2296 | =item >= 3 - script loading and management |
2240 | |
2297 | |