… | |
… | |
48 | C<--quoting-style=shell>. |
48 | C<--quoting-style=shell>. |
49 | |
49 | |
50 | A double-click usually selects the word under the cursor, further clicks |
50 | A double-click usually selects the word under the cursor, further clicks |
51 | will enlarge the selection. |
51 | will enlarge the selection. |
52 | |
52 | |
|
|
53 | The selection works by trying to match a number of regexes and displaying |
|
|
54 | them in increasing order of length. You can add your own regexes by |
|
|
55 | specifying resources of the form: |
|
|
56 | |
|
|
57 | URxvt.selection.pattern-0: perl-regex |
|
|
58 | URxvt.selection.pattern-1: perl-regex |
|
|
59 | ... |
|
|
60 | |
|
|
61 | The index number (0, 1...) must not have any holes, and each regex must |
|
|
62 | contain at least one pair of capturing parentheses, which will be used for |
|
|
63 | the match. For example, the followign adds a regex that matches everything |
|
|
64 | between two vertical bars: |
|
|
65 | |
|
|
66 | URxvt.selection.pattern-0: \\|([^|]+)\\| |
|
|
67 | |
|
|
68 | You can look at the source of the selection extension to see more |
|
|
69 | interesting uses, such as parsing a line from beginning to end. |
|
|
70 | |
53 | It also offers the following bindable keyboard command: |
71 | This extension also offers the following bindable keyboard command: |
54 | |
72 | |
55 | =over 4 |
73 | =over 4 |
56 | |
74 | |
57 | =item rot13 |
75 | =item rot13 |
58 | |
76 | |
… | |
… | |
86 | bottom. C<Escape> leaves search mode and returns to the point where search |
104 | bottom. C<Escape> leaves search mode and returns to the point where search |
87 | was started, while C<Enter> or C<Return> stay at the current position and |
105 | was started, while C<Enter> or C<Return> stay at the current position and |
88 | additionally stores the first match in the current line into the primary |
106 | additionally stores the first match in the current line into the primary |
89 | selection. |
107 | selection. |
90 | |
108 | |
91 | =item digital-clock |
109 | =item selection-autotransform |
92 | |
110 | |
93 | Displays a digital clock using the built-in overlay. |
111 | This selection allows you to do automatic transforms on a selection |
|
|
112 | whenever a selection is made. |
|
|
113 | |
|
|
114 | It works by specifying perl snippets (most useful is a single C<s///> |
|
|
115 | operator) that modify C<$_> as resources: |
|
|
116 | |
|
|
117 | URxvt.selection-autotransform.0: transform |
|
|
118 | URxvt.selection-autotransform.1: transform |
|
|
119 | ... |
|
|
120 | |
|
|
121 | For example, the following will transform selections of the form |
|
|
122 | C<filename:number>, often seen in compiler messages, into C<vi +$filename |
|
|
123 | $word>: |
|
|
124 | |
|
|
125 | URxvt.selection-autotransform.0: s/^(\\S+):(\\d+):?$/vi +$2 \\Q$1\\E\\x0d/ |
|
|
126 | |
|
|
127 | And this example matches the same,but replaces it with vi-commands you can |
|
|
128 | paste directly into your (vi :) editor: |
|
|
129 | |
|
|
130 | URxvt.selection-autotransform.0: s/^(S+):(d+):?$/\\x1b:e \\Q$1\\E\\x0d:$2\\x0d/ |
|
|
131 | |
|
|
132 | Of course, this can be modified to suit your needs and your editor :) |
|
|
133 | |
|
|
134 | To expand the example above to typical perl error messages ("XXX at |
|
|
135 | FILENAME line YYY."), you need a slightly more elaborate solution: |
|
|
136 | |
|
|
137 | URxvt.selection.pattern-0: ( at .*? line \\d+\\.) |
|
|
138 | URxvt.selection-autotransform.0: s/^ at (.*?) line (\\d+)\\.$/\x1b:e \\Q$1\E\\x0d:$2\\x0d/ |
|
|
139 | |
|
|
140 | The first line tells the selection code to treat the unchanging part of |
|
|
141 | every error message as a selection pattern, and the second line transforms |
|
|
142 | the message into vi commands to load the file. |
94 | |
143 | |
95 | =item mark-urls |
144 | =item mark-urls |
96 | |
145 | |
97 | Uses per-line display filtering (C<on_line_update>) to underline urls and |
146 | Uses per-line display filtering (C<on_line_update>) to underline urls and |
98 | make them clickable. When middle-clicked, the program specified in the |
147 | make them clickable. When middle-clicked, the program specified in the |
… | |
… | |
102 | =item block-graphics-to-ascii |
151 | =item block-graphics-to-ascii |
103 | |
152 | |
104 | A not very useful example of filtering all text output to the terminal, |
153 | A not very useful example of filtering all text output to the terminal, |
105 | by replacing all line-drawing characters (U+2500 .. U+259F) by a |
154 | by replacing all line-drawing characters (U+2500 .. U+259F) by a |
106 | similar-looking ascii character. |
155 | similar-looking ascii character. |
|
|
156 | |
|
|
157 | =item digital-clock |
|
|
158 | |
|
|
159 | Displays a digital clock using the built-in overlay. |
107 | |
160 | |
108 | =item example-refresh-hooks |
161 | =item example-refresh-hooks |
109 | |
162 | |
110 | Displays a very simple digital clock in the upper right corner of the |
163 | Displays a very simple digital clock in the upper right corner of the |
111 | window. Illustrates overwriting the refresh callbacks to create your own |
164 | window. Illustrates overwriting the refresh callbacks to create your own |
… | |
… | |
318 | |
371 | |
319 | Called whenever the user presses a key combination that has a |
372 | Called whenever the user presses a key combination that has a |
320 | C<perl:string> action bound to it (see description of the B<keysym> |
373 | C<perl:string> action bound to it (see description of the B<keysym> |
321 | resource in the @@RXVT_NAME@@(1) manpage). |
374 | resource in the @@RXVT_NAME@@(1) manpage). |
322 | |
375 | |
|
|
376 | =item on_x_event $term, $event |
|
|
377 | |
|
|
378 | Called on every X event received on the vt window (and possibly other |
|
|
379 | windows). Should only be used as a last resort. Most event structure |
|
|
380 | members are not passed. |
|
|
381 | |
323 | =item on_focus_in $term |
382 | =item on_focus_in $term |
324 | |
383 | |
325 | Called whenever the window gets the keyboard focus, before rxvt-unicode |
384 | Called whenever the window gets the keyboard focus, before rxvt-unicode |
326 | does focus in processing. |
385 | does focus in processing. |
327 | |
386 | |
… | |
… | |
437 | =item urxvt::CurrentTime |
496 | =item urxvt::CurrentTime |
438 | |
497 | |
439 | =item urxvt::ShiftMask, LockMask, ControlMask, Mod1Mask, Mod2Mask, |
498 | =item urxvt::ShiftMask, LockMask, ControlMask, Mod1Mask, Mod2Mask, |
440 | Mod3Mask, Mod4Mask, Mod5Mask, Button1Mask, Button2Mask, Button3Mask, |
499 | Mod3Mask, Mod4Mask, Mod5Mask, Button1Mask, Button2Mask, Button3Mask, |
441 | Button4Mask, Button5Mask, AnyModifier |
500 | Button4Mask, Button5Mask, AnyModifier |
|
|
501 | |
|
|
502 | =item urxvt::NoEventMask, KeyPressMask, KeyReleaseMask, |
|
|
503 | ButtonPressMask, ButtonReleaseMask, EnterWindowMask, LeaveWindowMask, |
|
|
504 | PointerMotionMask, PointerMotionHintMask, Button1MotionMask, Button2MotionMask, |
|
|
505 | Button3MotionMask, Button4MotionMask, Button5MotionMask, ButtonMotionMask, |
|
|
506 | KeymapStateMask, ExposureMask, VisibilityChangeMask, StructureNotifyMask, |
|
|
507 | ResizeRedirectMask, SubstructureNotifyMask, SubstructureRedirectMask, |
|
|
508 | FocusChangeMask, PropertyChangeMask, ColormapChangeMask, OwnerGrabButtonMask |
|
|
509 | |
|
|
510 | =item urxvt::KeyPress, KeyRelease, ButtonPress, ButtonRelease, MotionNotify, |
|
|
511 | EnterNotify, LeaveNotify, FocusIn, FocusOut, KeymapNotify, Expose, |
|
|
512 | GraphicsExpose, NoExpose, VisibilityNotify, CreateNotify, DestroyNotify, |
|
|
513 | UnmapNotify, MapNotify, MapRequest, ReparentNotify, ConfigureNotify, |
|
|
514 | ConfigureRequest, GravityNotify, ResizeRequest, CirculateNotify, |
|
|
515 | CirculateRequest, PropertyNotify, SelectionClear, SelectionRequest, |
|
|
516 | SelectionNotify, ColormapNotify, ClientMessage, MappingNotify |
442 | |
517 | |
443 | Various constants for use in X calls and event processing. |
518 | Various constants for use in X calls and event processing. |
444 | |
519 | |
445 | =back |
520 | =back |
446 | |
521 | |
… | |
… | |
514 | delete $ENV{CDPATH}; |
589 | delete $ENV{CDPATH}; |
515 | delete $ENV{BASH_ENV}; |
590 | delete $ENV{BASH_ENV}; |
516 | $ENV{PATH} = "/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/opt/bin:/opt/sbin"; |
591 | $ENV{PATH} = "/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/opt/bin:/opt/sbin"; |
517 | } |
592 | } |
518 | |
593 | |
519 | my @hook_count; |
|
|
520 | my $verbosity = $ENV{URXVT_PERL_VERBOSITY}; |
594 | my $verbosity = $ENV{URXVT_PERL_VERBOSITY}; |
521 | |
595 | |
522 | sub verbose { |
596 | sub verbose { |
523 | my ($level, $msg) = @_; |
597 | my ($level, $msg) = @_; |
524 | warn "$msg\n" if $level <= $verbosity; |
598 | warn "$msg\n" if $level <= $verbosity; |
… | |
… | |
612 | verbose 11, "$HOOKNAME[$htype] returning <$retval>" |
686 | verbose 11, "$HOOKNAME[$htype] returning <$retval>" |
613 | if $verbosity >= 11; |
687 | if $verbosity >= 11; |
614 | } |
688 | } |
615 | |
689 | |
616 | if ($htype == 1) { # DESTROY |
690 | if ($htype == 1) { # DESTROY |
617 | if (my $hook = delete $TERM->{_hook}) { |
|
|
618 | for my $htype (0..$#$hook) { |
|
|
619 | $hook_count[$htype] -= scalar keys %{ $hook->[$htype] || {} } |
|
|
620 | or set_should_invoke $htype, 0; |
|
|
621 | } |
|
|
622 | } |
|
|
623 | |
|
|
624 | # clear package objects |
691 | # clear package objects |
625 | %$_ = () for values %{ $TERM->{_pkg} }; |
692 | %$_ = () for values %{ $TERM->{_pkg} }; |
626 | |
693 | |
627 | # clear package |
694 | # clear package |
628 | %$TERM = (); |
695 | %$TERM = (); |
… | |
… | |
654 | while (my ($name, $cb) = each %hook) { |
721 | while (my ($name, $cb) = each %hook) { |
655 | my $htype = $HOOKTYPE{uc $name}; |
722 | my $htype = $HOOKTYPE{uc $name}; |
656 | defined $htype |
723 | defined $htype |
657 | or Carp::croak "unsupported hook type '$name'"; |
724 | or Carp::croak "unsupported hook type '$name'"; |
658 | |
725 | |
|
|
726 | $self->set_should_invoke ($htype, +1) |
659 | unless (exists $self->{term}{_hook}[$htype]{$pkg}) { |
727 | unless exists $self->{term}{_hook}[$htype]{$pkg}; |
660 | $hook_count[$htype]++ |
|
|
661 | or urxvt::set_should_invoke $htype, 1; |
|
|
662 | } |
|
|
663 | |
728 | |
664 | $self->{term}{_hook}[$htype]{$pkg} = $cb; |
729 | $self->{term}{_hook}[$htype]{$pkg} = $cb; |
665 | } |
730 | } |
666 | } |
731 | } |
667 | |
732 | |
… | |
… | |
672 | for my $name (@hook) { |
737 | for my $name (@hook) { |
673 | my $htype = $HOOKTYPE{uc $name}; |
738 | my $htype = $HOOKTYPE{uc $name}; |
674 | defined $htype |
739 | defined $htype |
675 | or Carp::croak "unsupported hook type '$name'"; |
740 | or Carp::croak "unsupported hook type '$name'"; |
676 | |
741 | |
|
|
742 | $self->set_should_invoke ($htype, -1) |
677 | if (delete $self->{term}{_hook}[$htype]{$pkg}) { |
743 | if delete $self->{term}{_hook}[$htype]{$pkg}; |
678 | --$hook_count[$htype] |
|
|
679 | or urxvt::set_should_invoke $htype, 0; |
|
|
680 | } |
|
|
681 | } |
744 | } |
682 | } |
745 | } |
683 | |
746 | |
684 | our $AUTOLOAD; |
747 | our $AUTOLOAD; |
685 | |
748 | |
… | |
… | |
1090 | |
1153 | |
1091 | =item $windowid = $term->vt |
1154 | =item $windowid = $term->vt |
1092 | |
1155 | |
1093 | Return the window id of the terminal window. |
1156 | Return the window id of the terminal window. |
1094 | |
1157 | |
|
|
1158 | =item $term->vt_emask_add ($x_event_mask) |
|
|
1159 | |
|
|
1160 | Adds the specified events to the vt event mask. Useful e.g. when you want |
|
|
1161 | to receive pointer events all the times: |
|
|
1162 | |
|
|
1163 | $term->vt_emask_add (urxvt::PointerMotionMask); |
|
|
1164 | |
1095 | =item $window_width = $term->width |
1165 | =item $window_width = $term->width |
1096 | |
1166 | |
1097 | =item $window_height = $term->height |
1167 | =item $window_height = $term->height |
1098 | |
1168 | |
1099 | =item $font_width = $term->fwidth |
1169 | =item $font_width = $term->fwidth |