ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/urxvt.pm
(Generate patch)

Comparing rxvt-unicode/src/urxvt.pm (file contents):
Revision 1.249 by root, Fri Dec 26 21:26:37 2014 UTC vs.
Revision 1.258 by root, Tue Sep 17 20:38:14 2019 UTC

45 45
46 URxvt.perl-ext-common: default,selection-autotransform 46 URxvt.perl-ext-common: default,selection-autotransform
47 47
48Extensions may add additional resources and C<actions>, i.e., methods 48Extensions may add additional resources and C<actions>, i.e., methods
49which can be bound to a key and invoked by the user. An extension can 49which can be bound to a key and invoked by the user. An extension can
50define the resources it support and also default bindings for one or 50define the resources it support using so called META comments,
51more actions it provides using so called META comments, described
52below. Similarly to builtin resources, extension resources can also be 51described below. Similarly to builtin resources, extension resources
53specified on the command line as long options (with C<.> replaced by 52can also be specified on the command line as long options (with C<.>
54C<->), in which case the corresponding extension is loaded 53replaced by C<->), in which case the corresponding extension is loaded
55automatically. For this to work the extension B<must> define META 54automatically. For this to work the extension B<must> define META
56comments for its resources. 55comments for its resources.
57 56
58=head1 API DOCUMENTATION 57=head1 API DOCUMENTATION
59 58
116the C<urxvt::extension> section below. 115the C<urxvt::extension> section below.
117 116
118=head2 META comments 117=head2 META comments
119 118
120Rxvt-unicode recognizes special meta comments in extensions that define 119Rxvt-unicode recognizes special meta comments in extensions that define
121different types of metadata. 120different types of metadata. These comments are scanned whenever a
121terminal is created and are typically used to autoload extensions when
122their resources or command line parameters are used.
122 123
123Currently, it recxognises only one such comment: 124Currently, it recognises only one such comment:
124 125
125=over 4 126=over 4
126 127
127=item #:META:RESOURCE:name:type:desc 128=item #:META:RESOURCE:name:type:desc
128 129
129The RESOURCE comment defines a resource used by the extension, where 130The RESOURCE comment defines a resource used by the extension, where
130C<name> is the resource name, C<type> is the resource type, C<boolean> 131C<name> is the resource name, C<type> is the resource type, C<boolean>
131or C<string>, and C<desc> is the resource description. 132or C<string>, and C<desc> is the resource description.
133
134The extension will be autoloaded when this resource is specified or used
135as a command line parameter.
132 136
133=back 137=back
134 138
135=head2 Hooks 139=head2 Hooks
136 140
512ConfigureRequest, GravityNotify, ResizeRequest, CirculateNotify, 516ConfigureRequest, GravityNotify, ResizeRequest, CirculateNotify,
513CirculateRequest, PropertyNotify, SelectionClear, SelectionRequest, 517CirculateRequest, PropertyNotify, SelectionClear, SelectionRequest,
514SelectionNotify, ColormapNotify, ClientMessage, MappingNotify 518SelectionNotify, ColormapNotify, ClientMessage, MappingNotify
515 519
516Various constants for use in X calls and event processing. 520Various constants for use in X calls and event processing.
521
522=item urxvt::PrivMode_132, PrivMode_132OK, PrivMode_rVideo, PrivMode_relOrigin,
523PrivMode_Screen, PrivMode_Autowrap, PrivMode_aplCUR, PrivMode_aplKP,
524PrivMode_HaveBackSpace, PrivMode_BackSpace, PrivMode_ShiftKeys,
525PrivMode_VisibleCursor, PrivMode_MouseX10, PrivMode_MouseX11,
526PrivMode_scrollBar, PrivMode_TtyOutputInh, PrivMode_Keypress,
527PrivMode_smoothScroll, PrivMode_vt52, PrivMode_LFNL, PrivMode_MouseBtnEvent,
528PrivMode_MouseAnyEvent, PrivMode_BracketPaste, PrivMode_ExtModeMouse,
529PrivMode_ExtMouseRight, PrivMode_BlinkingCursor, PrivMode_mouse_report,
530PrivMode_Default
531
532Constants for checking DEC private modes.
517 533
518=back 534=back
519 535
520=head2 RENDITION 536=head2 RENDITION
521 537
589sub parse_resource { 605sub 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;
604 } 622 }
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];
627
628 return 1 unless $isarg;
609 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 {
1135 my ($self) = @_; 1155 my ($self) = @_;
1136 1156
1137 return if exists $self->{meta}; 1157 return if exists $self->{meta};
1138 1158
1139 my @urxvtdirs = perl_libdirs $self; 1159 my @urxvtdirs = perl_libdirs $self;
1140 my @cpandirs = grep -d, map "$_/URxvt/Ext", @INC; 1160# my @cpandirs = grep -d, map "$_/URxvt/Ext", @INC;
1141 1161
1142 $self->{meta} = \my %meta; 1162 $self->{meta} = \my %meta;
1143 1163
1144 # first gather extensions 1164 # first gather extensions
1145 1165
1182 1202
1183 $meta{ext}{$ext} = \%ext; 1203 $meta{ext}{$ext} = \%ext;
1184 } 1204 }
1185 }; 1205 };
1186 1206
1187 $gather->($_, 0) for @cpandirs; 1207# $gather->($_, 0) for @cpandirs;
1188 $gather->($_, 1) for @urxvtdirs; 1208 $gather->($_, 1) for @urxvtdirs;
1189 1209
1190 # and now merge resources 1210 # and now merge resources
1211
1212 $meta{resource} = \my %resource;
1213
1191 while (my ($k, $v) = each %{ $meta{ext} }) { 1214 while (my ($k, $v) = each %{ $meta{ext} }) {
1192 #TODO: should check for extensions overriding each other 1215 #TODO: should check for extensions overriding each other
1193 %{ $meta{resource} } = (%{ $meta{resource} }, %{ $v->{resource} }); 1216 %resource = (%resource, %{ $v->{resource} });
1194 } 1217 }
1195} 1218}
1196 1219
1197=item $term = new urxvt::term $envhashref, $rxvtname, [arg...] 1220=item $term = new urxvt::term $envhashref, $rxvtname, [arg...]
1198 1221
1344 my $res = &x_resource; 1367 my $res = &x_resource;
1345 1368
1346 $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
1347} 1370}
1348 1371
1372=item $action = $term->lookup_keysym ($keysym, $state)
1373
1374Returns the action bound to key combination C<($keysym, $state)>,
1375if a binding for it exists, and C<undef> otherwise.
1376
1349=item $success = $term->bind_action ($key, $action) 1377=item $success = $term->bind_action ($key, $action)
1350 1378
1351Adds a key binding exactly as specified via a C<keysym> resource. See the 1379Adds a key binding exactly as specified via a C<keysym> resource. See the
1352C<keysym> resource in the urxvt(1) manpage. 1380C<keysym> resource in the urxvt(1) manpage.
1353 1381
1354To add default bindings for an extension, the extension should call C<< 1382To add default bindings for actions, an extension should call C<<
1355->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
1356in the C<init> hook allows users the override or remove the the binding 1384in the C<init> hook allows users to override or remove the binding
1357again. 1385again.
1358 1386
1359Example: the C<searchable-scrollback> by default binds itself 1387Example: the C<searchable-scrollback> by default binds itself
1360on C<Meta-s>, using C<< $self->bind_action >>, which calls C<< 1388on C<Meta-s>, using C<< $self->bind_action >>, which calls C<<
1361$term->bind_action >>. 1389$term->bind_action >>.
1610 1638
1611=item $term->key_release ($state, $keycode[, $time]) 1639=item $term->key_release ($state, $keycode[, $time])
1612 1640
1613Deliver various fake events to to terminal. 1641Deliver various fake events to to terminal.
1614 1642
1615=item $window_width = $term->width 1643=item $window_width = $term->width ([$new_value])
1616 1644
1617=item $window_height = $term->height 1645=item $window_height = $term->height ([$new_value])
1618 1646
1619=item $font_width = $term->fwidth 1647=item $font_width = $term->fwidth ([$new_value])
1620 1648
1621=item $font_height = $term->fheight 1649=item $font_height = $term->fheight ([$new_value])
1622 1650
1623=item $font_ascent = $term->fbase 1651=item $font_ascent = $term->fbase ([$new_value])
1624 1652
1625=item $terminal_rows = $term->nrow 1653=item $terminal_rows = $term->nrow ([$new_value])
1626 1654
1627=item $terminal_columns = $term->ncol 1655=item $terminal_columns = $term->ncol ([$new_value])
1628 1656
1629=item $has_focus = $term->focus 1657=item $has_focus = $term->focus ([$new_value])
1630 1658
1631=item $is_mapped = $term->mapped 1659=item $is_mapped = $term->mapped ([$new_value])
1632 1660
1633=item $max_scrollback = $term->saveLines 1661=item $max_scrollback = $term->saveLines ([$new_value])
1634 1662
1635=item $nrow_plus_saveLines = $term->total_rows 1663=item $nrow_plus_saveLines = $term->total_rows ([$new_value])
1636 1664
1637=item $topmost_scrollback_row = $term->top_row 1665=item $topmost_scrollback_row = $term->top_row ([$new_value])
1638 1666
1639Return various integers describing terminal characteristics. 1667Return various integers describing terminal characteristics. If an
1668argument is given, changes the value and returns the previous one.
1640 1669
1641=item $x_display = $term->display_id 1670=item $x_display = $term->display_id
1642 1671
1643Return the DISPLAY used by rxvt-unicode. 1672Return the DISPLAY used by rxvt-unicode.
1644 1673
1680Returns the currently displayed screen (0 primary, 1 secondary). 1709Returns the currently displayed screen (0 primary, 1 secondary).
1681 1710
1682=item $cursor_is_hidden = $term->hidden_cursor 1711=item $cursor_is_hidden = $term->hidden_cursor
1683 1712
1684Returns whether the cursor is currently hidden or not. 1713Returns whether the cursor is currently hidden or not.
1714
1715=item $priv_modes = $term->priv_modes
1716
1717Returns a bitset with the state of DEC private modes.
1718
1719Example:
1720
1721 if ($term->priv_modes & urxvt::PrivMode_mouse_report) {
1722 # mouse reporting is turned on
1723 }
1685 1724
1686=item $view_start = $term->view_start ([$newvalue]) 1725=item $view_start = $term->view_start ([$newvalue])
1687 1726
1688Returns the row number of the topmost displayed line. Maximum value is 1727Returns the row number of the topmost displayed line. Maximum value is
1689C<0>, which displays the normal terminal contents. Lower values scroll 1728C<0>, which displays the normal terminal contents. Lower values scroll
1694Requests a screen refresh. At the next opportunity, rxvt-unicode will 1733Requests a screen refresh. At the next opportunity, rxvt-unicode will
1695compare the on-screen display with its stored representation. If they 1734compare the on-screen display with its stored representation. If they
1696differ, it redraws the differences. 1735differ, it redraws the differences.
1697 1736
1698Used after changing terminal contents to display them. 1737Used after changing terminal contents to display them.
1738
1739=item $term->refresh_check
1740
1741Checks if a refresh has been requested and, if so, schedules one.
1699 1742
1700=item $text = $term->ROW_t ($row_number[, $new_text[, $start_col]]) 1743=item $text = $term->ROW_t ($row_number[, $new_text[, $start_col]])
1701 1744
1702Returns the text of the entire row with number C<$row_number>. Row C<< $term->top_row >> 1745Returns the text of the entire row with number C<$row_number>. Row C<< $term->top_row >>
1703is the topmost terminal line, row C<< $term->nrow-1 >> is the bottommost 1746is the topmost terminal line, row C<< $term->nrow-1 >> is the bottommost

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines