… | |
… | |
115 | the C<urxvt::extension> section below. |
115 | the C<urxvt::extension> section below. |
116 | |
116 | |
117 | =head2 META comments |
117 | =head2 META comments |
118 | |
118 | |
119 | Rxvt-unicode recognizes special meta comments in extensions that define |
119 | Rxvt-unicode recognizes special meta comments in extensions that define |
120 | 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. |
121 | |
123 | |
122 | Currently, it recognises only one such comment: |
124 | Currently, it recognises only one such comment: |
123 | |
125 | |
124 | =over 4 |
126 | =over 4 |
125 | |
127 | |
126 | =item #:META:RESOURCE:name:type:desc |
128 | =item #:META:RESOURCE:name:type:desc |
127 | |
129 | |
128 | The RESOURCE comment defines a resource used by the extension, where |
130 | The RESOURCE comment defines a resource used by the extension, where |
129 | 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> |
130 | or C<string>, and C<desc> is the resource description. |
132 | or C<string>, and C<desc> is the resource description. |
|
|
133 | |
|
|
134 | The extension will be autoloaded when this resource is specified or used |
|
|
135 | as a command line parameter. |
131 | |
136 | |
132 | =back |
137 | =back |
133 | |
138 | |
134 | =head2 Hooks |
139 | =head2 Hooks |
135 | |
140 | |
… | |
… | |
511 | ConfigureRequest, GravityNotify, ResizeRequest, CirculateNotify, |
516 | ConfigureRequest, GravityNotify, ResizeRequest, CirculateNotify, |
512 | CirculateRequest, PropertyNotify, SelectionClear, SelectionRequest, |
517 | CirculateRequest, PropertyNotify, SelectionClear, SelectionRequest, |
513 | SelectionNotify, ColormapNotify, ClientMessage, MappingNotify |
518 | SelectionNotify, ColormapNotify, ClientMessage, MappingNotify |
514 | |
519 | |
515 | Various constants for use in X calls and event processing. |
520 | Various constants for use in X calls and event processing. |
|
|
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. |
516 | |
533 | |
517 | =back |
534 | =back |
518 | |
535 | |
519 | =head2 RENDITION |
536 | =head2 RENDITION |
520 | |
537 | |
… | |
… | |
588 | sub parse_resource { |
605 | sub parse_resource { |
589 | my ($term, $name, $isarg, $longopt, $flag, $value) = @_; |
606 | my ($term, $name, $isarg, $longopt, $flag, $value) = @_; |
590 | |
607 | |
591 | $term->scan_extensions; |
608 | $term->scan_extensions; |
592 | |
609 | |
|
|
610 | # iterating over all resources has quadratic time overhead |
|
|
611 | # overall, maybe this could be optimised? |
593 | my $r = $term->{meta}{resource}; |
612 | my $r = $term->{meta}{resource}; |
594 | keys %$r; # reset iterator |
613 | keys %$r; # reset iterator |
595 | while (my ($k, $v) = each %$r) { |
614 | while (my ($k, $v) = each %$r) { |
596 | my $pattern = $k; |
615 | my $pattern = $k; |
597 | $pattern =~ y/./-/ if $isarg; |
616 | $pattern =~ y/./-/ if $isarg; |
… | |
… | |
604 | if ($pattern eq $prefix) { |
623 | if ($pattern eq $prefix) { |
605 | $name = "$urxvt::RESCLASS.$k$suffix"; |
624 | $name = "$urxvt::RESCLASS.$k$suffix"; |
606 | |
625 | |
607 | push @{ $term->{perl_ext_3} }, $v->[0]; |
626 | push @{ $term->{perl_ext_3} }, $v->[0]; |
608 | |
627 | |
|
|
628 | return 1 unless $isarg; |
|
|
629 | |
609 | if ($v->[1] eq "boolean") { |
630 | if ($v->[1] eq "boolean") { |
610 | $term->put_option_db ($name, $flag ? "true" : "false"); |
631 | $term->put_option_db ($name, $flag ? "true" : "false"); |
611 | return 1; |
632 | return 1; |
612 | } else { |
633 | } else { |
613 | $term->put_option_db ($name, $value); |
634 | $term->put_option_db ($name, $value); |
… | |
… | |
708 | @TERM_EXT = (); |
729 | @TERM_EXT = (); |
709 | $TERM->register_package ($_) for @pkg; |
730 | $TERM->register_package ($_) for @pkg; |
710 | } |
731 | } |
711 | |
732 | |
712 | for ( |
733 | for ( |
|
|
734 | @{ delete $TERM->{perl_ext_3} }, |
713 | (grep $_, map { split /,/, $TERM->resource ("perl_ext_$_") } 1, 2), |
735 | (grep $_, map { split /,/, $TERM->resource ("perl_ext_$_") } 1, 2), |
714 | @{ delete $TERM->{perl_ext_3} } |
|
|
715 | ) { |
736 | ) { |
716 | if ($_ eq "default") { |
737 | if ($_ eq "default") { |
717 | |
738 | |
718 | $ext_arg{$_} = [] |
739 | $ext_arg{$_} = [] |
719 | for qw(selection option-popup selection-popup readline searchable-scrollback); |
740 | for qw(selection option-popup selection-popup readline searchable-scrollback confirm-paste); |
720 | |
741 | |
721 | for ($TERM->_keysym_resources) { |
742 | for ($TERM->_keysym_resources) { |
722 | next if /^(?:string|command|builtin|builtin-string|perl)/; |
743 | next if /^(?:string|command|builtin|builtin-string|perl)/; |
723 | next unless /^([A-Za-z0-9_\-]+):/; |
744 | next unless /^([A-Za-z0-9_\-]+):/; |
724 | |
745 | |
… | |
… | |
1134 | my ($self) = @_; |
1155 | my ($self) = @_; |
1135 | |
1156 | |
1136 | return if exists $self->{meta}; |
1157 | return if exists $self->{meta}; |
1137 | |
1158 | |
1138 | my @urxvtdirs = perl_libdirs $self; |
1159 | my @urxvtdirs = perl_libdirs $self; |
1139 | my @cpandirs = grep -d, map "$_/URxvt/Ext", @INC; |
1160 | # my @cpandirs = grep -d, map "$_/URxvt/Ext", @INC; |
1140 | |
1161 | |
1141 | $self->{meta} = \my %meta; |
1162 | $self->{meta} = \my %meta; |
1142 | |
1163 | |
1143 | # first gather extensions |
1164 | # first gather extensions |
1144 | |
1165 | |
… | |
… | |
1181 | |
1202 | |
1182 | $meta{ext}{$ext} = \%ext; |
1203 | $meta{ext}{$ext} = \%ext; |
1183 | } |
1204 | } |
1184 | }; |
1205 | }; |
1185 | |
1206 | |
1186 | $gather->($_, 0) for @cpandirs; |
1207 | # $gather->($_, 0) for @cpandirs; |
1187 | $gather->($_, 1) for @urxvtdirs; |
1208 | $gather->($_, 1) for @urxvtdirs; |
1188 | |
1209 | |
1189 | # and now merge resources |
1210 | # and now merge resources |
1190 | |
1211 | |
1191 | $meta{resource} = \my %resource; |
1212 | $meta{resource} = \my %resource; |
… | |
… | |
1263 | insecure intensityStyles iso14755 iso14755_52 jumpScroll loginShell |
1284 | insecure intensityStyles iso14755 iso14755_52 jumpScroll loginShell |
1264 | mapAlert meta8 mouseWheelScrollPage override_redirect pastableTabs |
1285 | mapAlert meta8 mouseWheelScrollPage override_redirect pastableTabs |
1265 | pointerBlank reverseVideo scrollBar scrollBar_floating scrollBar_right |
1286 | pointerBlank reverseVideo scrollBar scrollBar_floating scrollBar_right |
1266 | scrollTtyKeypress scrollTtyOutput scrollWithBuffer secondaryScreen |
1287 | scrollTtyKeypress scrollTtyOutput scrollWithBuffer secondaryScreen |
1267 | secondaryScroll skipBuiltinGlyphs skipScroll transparent tripleclickwords |
1288 | secondaryScroll skipBuiltinGlyphs skipScroll transparent tripleclickwords |
1268 | urgentOnBell utmpInhibit visualBell |
1289 | urgentOnBell utmpInhibit visualBell disablePasteBrackets |
1269 | |
1290 | |
1270 | =item $value = $term->resource ($name[, $newval]) |
1291 | =item $value = $term->resource ($name[, $newval]) |
1271 | |
1292 | |
1272 | Returns the current resource value associated with a given name and |
1293 | Returns the current resource value associated with a given name and |
1273 | 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> |
… | |
… | |
1299 | preeditType print_pipe pty_fd reverseVideo saveLines scrollBar |
1320 | preeditType print_pipe pty_fd reverseVideo saveLines scrollBar |
1300 | scrollBar_align scrollBar_floating scrollBar_right scrollBar_thickness |
1321 | scrollBar_align scrollBar_floating scrollBar_right scrollBar_thickness |
1301 | scrollTtyKeypress scrollTtyOutput scrollWithBuffer scrollstyle |
1322 | scrollTtyKeypress scrollTtyOutput scrollWithBuffer scrollstyle |
1302 | secondaryScreen secondaryScroll shade skipBuiltinGlyphs skipScroll |
1323 | secondaryScreen secondaryScroll shade skipBuiltinGlyphs skipScroll |
1303 | term_name title transient_for transparent tripleclickwords urgentOnBell |
1324 | term_name title transient_for transparent tripleclickwords urgentOnBell |
1304 | utmpInhibit visualBell |
1325 | utmpInhibit visualBell rewrapMode disablePasteBrackets |
1305 | |
1326 | |
1306 | =cut |
1327 | =cut |
1307 | |
1328 | |
1308 | sub resource($$;$) { |
1329 | sub resource($$;$) { |
1309 | my ($self, $name) = (shift, shift); |
1330 | my ($self, $name) = (shift, shift); |
… | |
… | |
1346 | my $res = &x_resource; |
1367 | my $res = &x_resource; |
1347 | |
1368 | |
1348 | $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 |
1349 | } |
1370 | } |
1350 | |
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 | |
1351 | =item $success = $term->bind_action ($key, $action) |
1377 | =item $success = $term->bind_action ($key, $action) |
1352 | |
1378 | |
1353 | 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 |
1354 | C<keysym> resource in the urxvt(1) manpage. |
1380 | C<keysym> resource in the urxvt(1) manpage. |
1355 | |
1381 | |
… | |
… | |
1612 | |
1638 | |
1613 | =item $term->key_release ($state, $keycode[, $time]) |
1639 | =item $term->key_release ($state, $keycode[, $time]) |
1614 | |
1640 | |
1615 | Deliver various fake events to to terminal. |
1641 | Deliver various fake events to to terminal. |
1616 | |
1642 | |
1617 | =item $window_width = $term->width |
1643 | =item $window_width = $term->width ([$new_value]) |
1618 | |
1644 | |
1619 | =item $window_height = $term->height |
1645 | =item $window_height = $term->height ([$new_value]) |
1620 | |
1646 | |
1621 | =item $font_width = $term->fwidth |
1647 | =item $font_width = $term->fwidth ([$new_value]) |
1622 | |
1648 | |
1623 | =item $font_height = $term->fheight |
1649 | =item $font_height = $term->fheight ([$new_value]) |
1624 | |
1650 | |
1625 | =item $font_ascent = $term->fbase |
1651 | =item $font_ascent = $term->fbase ([$new_value]) |
1626 | |
1652 | |
1627 | =item $terminal_rows = $term->nrow |
1653 | =item $terminal_rows = $term->nrow ([$new_value]) |
1628 | |
1654 | |
1629 | =item $terminal_columns = $term->ncol |
1655 | =item $terminal_columns = $term->ncol ([$new_value]) |
1630 | |
1656 | |
1631 | =item $has_focus = $term->focus |
1657 | =item $has_focus = $term->focus ([$new_value]) |
1632 | |
1658 | |
1633 | =item $is_mapped = $term->mapped |
1659 | =item $is_mapped = $term->mapped ([$new_value]) |
1634 | |
1660 | |
1635 | =item $max_scrollback = $term->saveLines |
1661 | =item $max_scrollback = $term->saveLines ([$new_value]) |
1636 | |
1662 | |
1637 | =item $nrow_plus_saveLines = $term->total_rows |
1663 | =item $nrow_plus_saveLines = $term->total_rows ([$new_value]) |
1638 | |
1664 | |
1639 | =item $topmost_scrollback_row = $term->top_row |
1665 | =item $topmost_scrollback_row = $term->top_row ([$new_value]) |
1640 | |
1666 | |
1641 | 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. |
1642 | |
1669 | |
1643 | =item $x_display = $term->display_id |
1670 | =item $x_display = $term->display_id |
1644 | |
1671 | |
1645 | Return the DISPLAY used by rxvt-unicode. |
1672 | Return the DISPLAY used by rxvt-unicode. |
1646 | |
1673 | |
… | |
… | |
1683 | |
1710 | |
1684 | =item $cursor_is_hidden = $term->hidden_cursor |
1711 | =item $cursor_is_hidden = $term->hidden_cursor |
1685 | |
1712 | |
1686 | Returns whether the cursor is currently hidden or not. |
1713 | Returns whether the cursor is currently hidden or not. |
1687 | |
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 | |
1688 | =item $view_start = $term->view_start ([$newvalue]) |
1725 | =item $view_start = $term->view_start ([$newvalue]) |
1689 | |
1726 | |
1690 | 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, |
1691 | 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 |
1692 | this many lines into the scrollback buffer. |
1729 | the terminal contents. Lower values scroll this many lines into the |
|
|
1730 | scrollback buffer. |
1693 | |
1731 | |
1694 | =item $term->want_refresh |
1732 | =item $term->want_refresh |
1695 | |
1733 | |
1696 | Requests a screen refresh. At the next opportunity, rxvt-unicode will |
1734 | Requests a screen refresh. At the next opportunity, rxvt-unicode will |
1697 | compare the on-screen display with its stored representation. If they |
1735 | compare the on-screen display with its stored representation. If they |
1698 | differ, it redraws the differences. |
1736 | differ, it redraws the differences. |
1699 | |
1737 | |
1700 | 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. |
1701 | |
1743 | |
1702 | =item $text = $term->ROW_t ($row_number[, $new_text[, $start_col]]) |
1744 | =item $text = $term->ROW_t ($row_number[, $new_text[, $start_col]]) |
1703 | |
1745 | |
1704 | 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 >> |
1705 | 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 |