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.254 by sf-exg, Tue Mar 17 09:23:08 2015 UTC vs.
Revision 1.264 by root, Sat Jul 24 09:42:15 2021 UTC

4 4
5urxvtperl - rxvt-unicode's embedded perl interpreter 5urxvtperl - 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
22Every time a terminal object gets created, extension scripts specified via 22Every time a terminal object gets created, extension scripts specified via
23the C<perl> resource are loaded and associated with it. 23the C<perl> resource are loaded and associated with it.
115the C<urxvt::extension> section below. 115the C<urxvt::extension> section below.
116 116
117=head2 META comments 117=head2 META comments
118 118
119Rxvt-unicode recognizes special meta comments in extensions that define 119Rxvt-unicode recognizes special meta comments in extensions that define
120different 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.
121 123
122Currently, it recognises only one such comment: 124Currently, 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
128The RESOURCE comment defines a resource used by the extension, where 130The RESOURCE comment defines a resource used by the extension, where
129C<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>
130or 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.
131 136
132=back 137=back
133 138
134=head2 Hooks 139=head2 Hooks
135 140
511ConfigureRequest, GravityNotify, ResizeRequest, CirculateNotify, 516ConfigureRequest, GravityNotify, ResizeRequest, CirculateNotify,
512CirculateRequest, PropertyNotify, SelectionClear, SelectionRequest, 517CirculateRequest, PropertyNotify, SelectionClear, SelectionRequest,
513SelectionNotify, ColormapNotify, ClientMessage, MappingNotify 518SelectionNotify, ColormapNotify, ClientMessage, MappingNotify
514 519
515Various 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_ExtMouseUTF8,
529PrivMode_ExtMouseUrxvt, PrivMode_BlinkingCursor, PrivMode_mouse_report,
530PrivMode_Default
531
532Constants for checking DEC private modes.
516 533
517=back 534=back
518 535
519=head2 RENDITION 536=head2 RENDITION
520 537
588sub parse_resource { 605sub 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
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
1272Returns the current resource value associated with a given name and 1293Returns the current resource value associated with a given name and
1273optionally sets a new value. Setting values is most useful in the C<init> 1294optionally 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
1308sub resource($$;$) { 1329sub resource($$;$) {
1309 my ($self, $name) = (shift, shift); 1330 my ($self, $name) = (shift, shift);
1617 1638
1618=item $term->key_release ($state, $keycode[, $time]) 1639=item $term->key_release ($state, $keycode[, $time])
1619 1640
1620Deliver various fake events to to terminal. 1641Deliver various fake events to to terminal.
1621 1642
1622=item $window_width = $term->width 1643=item $window_width = $term->width ([$new_value])
1623 1644
1624=item $window_height = $term->height 1645=item $window_height = $term->height ([$new_value])
1625 1646
1626=item $font_width = $term->fwidth 1647=item $font_width = $term->fwidth ([$new_value])
1627 1648
1628=item $font_height = $term->fheight 1649=item $font_height = $term->fheight ([$new_value])
1629 1650
1630=item $font_ascent = $term->fbase 1651=item $font_ascent = $term->fbase ([$new_value])
1631 1652
1632=item $terminal_rows = $term->nrow 1653=item $terminal_rows = $term->nrow ([$new_value])
1633 1654
1634=item $terminal_columns = $term->ncol 1655=item $terminal_columns = $term->ncol ([$new_value])
1635 1656
1636=item $has_focus = $term->focus 1657=item $has_focus = $term->focus ([$new_value])
1637 1658
1638=item $is_mapped = $term->mapped 1659=item $is_mapped = $term->mapped ([$new_value])
1639 1660
1640=item $max_scrollback = $term->saveLines 1661=item $max_scrollback = $term->saveLines ([$new_value])
1641 1662
1642=item $nrow_plus_saveLines = $term->total_rows 1663=item $nrow_plus_saveLines = $term->total_rows ([$new_value])
1643 1664
1644=item $topmost_scrollback_row = $term->top_row 1665=item $topmost_scrollback_row = $term->top_row ([$new_value])
1645 1666
1646Return various integers describing terminal characteristics. 1667Return various integers describing terminal characteristics. If an
1668argument is given, changes the value and returns the previous one.
1647 1669
1648=item $x_display = $term->display_id 1670=item $x_display = $term->display_id
1649 1671
1650Return the DISPLAY used by rxvt-unicode. 1672Return the DISPLAY used by rxvt-unicode.
1651 1673
1688 1710
1689=item $cursor_is_hidden = $term->hidden_cursor 1711=item $cursor_is_hidden = $term->hidden_cursor
1690 1712
1691Returns whether the cursor is currently hidden or not. 1713Returns whether the cursor is currently hidden or not.
1692 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 }
1724
1693=item $view_start = $term->view_start ([$newvalue]) 1725=item $view_start = $term->view_start ([$newvalue])
1694 1726
1695Returns the row number of the topmost displayed line. Maximum value is 1727Returns the row number of the topmost displayed line and changes it,
1696C<0>, which displays the normal terminal contents. Lower values scroll 1728if an argument is given. Values greater than or equal to C<0> display
1697this many lines into the scrollback buffer. 1729the terminal contents. Lower values scroll this many lines into the
1730scrollback buffer.
1698 1731
1699=item $term->want_refresh 1732=item $term->want_refresh
1700 1733
1701Requests a screen refresh. At the next opportunity, rxvt-unicode will 1734Requests a screen refresh. At the next opportunity, rxvt-unicode will
1702compare the on-screen display with its stored representation. If they 1735compare the on-screen display with its stored representation. If they

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines