… | |
… | |
32 | and "perl-ext-common" resources to the empty string. |
32 | and "perl-ext-common" resources to the empty string. |
33 | |
33 | |
34 | =head1 PREPACKAGED EXTENSIONS |
34 | =head1 PREPACKAGED EXTENSIONS |
35 | |
35 | |
36 | A number of extensions are delivered with this release. You can find them |
36 | A number of extensions are delivered with this release. You can find them |
37 | in F<@@RXVT_LIBDIR@@/urxvt/perl/>, and the documentation can be vewiwed |
37 | in F<@@RXVT_LIBDIR@@/urxvt/perl/>, and the documentation can be viewed |
38 | using F<< man urxvt-<EXTENSIONNAME> >>. |
38 | using F<< man urxvt-<EXTENSIONNAME> >>. |
39 | |
39 | |
40 | You can activate them like this: |
40 | You can activate them like this: |
41 | |
41 | |
42 | @@RXVT_NAME@@ -pe <extensionname> |
42 | @@RXVT_NAME@@ -pe <extensionname> |
… | |
… | |
44 | Or by adding them to the resource for extensions loaded by default: |
44 | Or by adding them to the resource for extensions loaded by default: |
45 | |
45 | |
46 | URxvt.perl-ext-common: default,selection-autotransform |
46 | URxvt.perl-ext-common: default,selection-autotransform |
47 | |
47 | |
48 | Extensions that add command line parameters or resources on their own are |
48 | Extensions that add command line parameters or resources on their own are |
49 | laoded automatically when used. |
49 | loaded automatically when used. |
50 | |
50 | |
51 | =head1 API DOCUMENTATION |
51 | =head1 API DOCUMENTATION |
52 | |
52 | |
53 | =head2 General API Considerations |
53 | =head2 General API Considerations |
54 | |
54 | |
… | |
… | |
112 | =item $urxvt_term = $self->{term} |
112 | =item $urxvt_term = $self->{term} |
113 | |
113 | |
114 | Returns the C<urxvt::term> object associated with this instance of the |
114 | Returns the C<urxvt::term> object associated with this instance of the |
115 | extension. This member I<must not> be changed in any way. |
115 | extension. This member I<must not> be changed in any way. |
116 | |
116 | |
117 | =item $self->enable ($hook_name => $cb, [$hook_name => $cb..]) |
117 | =item $self->enable ($hook_name => $cb[, $hook_name => $cb..]) |
118 | |
118 | |
119 | Dynamically enable the given hooks (named without the C<on_> prefix) for |
119 | Dynamically enable the given hooks (named without the C<on_> prefix) for |
120 | this extension, replacing any previous hook. This is useful when you want |
120 | this extension, replacing any previous hook. This is useful when you want |
121 | to overwrite time-critical hooks only temporarily. |
121 | to overwrite time-critical hooks only temporarily. |
122 | |
122 | |
|
|
123 | To install additional callbacks for the same hook, you cna use the C<on> |
|
|
124 | method of the C<urxvt::term> class. |
|
|
125 | |
123 | =item $self->disable ($hook_name[, $hook_name..]) |
126 | =item $self->disable ($hook_name[, $hook_name..]) |
124 | |
127 | |
125 | Dynamically disable the given hooks. |
128 | Dynamically disable the given hooks. |
|
|
129 | |
|
|
130 | =item $self->x_resource ($pattern) |
|
|
131 | |
|
|
132 | =item $self->x_resource_boolean ($pattern) |
|
|
133 | |
|
|
134 | These methods support an additional C<%> prefix when called on an |
|
|
135 | extension object - see the description of these methods in the |
|
|
136 | C<urxvt::term> class for details. |
126 | |
137 | |
127 | =back |
138 | =back |
128 | |
139 | |
129 | =head2 Hooks |
140 | =head2 Hooks |
130 | |
141 | |
… | |
… | |
735 | if (my $cb = $TERM->{_hook}[$htype]) { |
746 | if (my $cb = $TERM->{_hook}[$htype]) { |
736 | verbose 10, "$HOOKNAME[$htype] (" . (join ", ", $TERM, @_) . ")" |
747 | verbose 10, "$HOOKNAME[$htype] (" . (join ", ", $TERM, @_) . ")" |
737 | if $verbosity >= 10; |
748 | if $verbosity >= 10; |
738 | |
749 | |
739 | for my $pkg (keys %$cb) { |
750 | for my $pkg (keys %$cb) { |
740 | my $retval_ = eval { $cb->{$pkg}->($TERM->{_pkg}{$pkg}, @_) }; |
751 | my $retval_ = eval { $cb->{$pkg}->($TERM->{_pkg}{$pkg} || $TERM, @_) }; |
741 | $retval ||= $retval_; |
752 | $retval ||= $retval_; |
742 | |
753 | |
743 | if ($@) { |
754 | if ($@) { |
744 | $TERM->ungrab; # better to lose the grab than the session |
755 | $TERM->ungrab; # better to lose the grab than the session |
745 | warn $@; |
756 | warn $@; |
… | |
… | |
1058 | |
1069 | |
1059 | Destroy the terminal object (close the window, free resources |
1070 | Destroy the terminal object (close the window, free resources |
1060 | etc.). Please note that @@RXVT_NAME@@ will not exit as long as any event |
1071 | etc.). Please note that @@RXVT_NAME@@ will not exit as long as any event |
1061 | watchers (timers, io watchers) are still active. |
1072 | watchers (timers, io watchers) are still active. |
1062 | |
1073 | |
|
|
1074 | =item $guard = $self->on ($hook_name => $cb[, $hook_name => $cb..]) |
|
|
1075 | |
|
|
1076 | Similar to the extension method C<enable>, but installs additional |
|
|
1077 | callbacks for the givne hook(s) (existing ones are not replaced), and |
|
|
1078 | returns a guard object. When the guard object is destroyed the callbacks |
|
|
1079 | are disabled again. |
|
|
1080 | |
|
|
1081 | Note that these callbacks receive the normal paramaters, but the first |
|
|
1082 | argument (normally the extension) is currently undefined. |
|
|
1083 | |
|
|
1084 | =cut |
|
|
1085 | |
|
|
1086 | sub urxvt::term::on_disable::DESTROY { |
|
|
1087 | my $disable = shift; |
|
|
1088 | |
|
|
1089 | my $self = delete $disable->{""}; |
|
|
1090 | |
|
|
1091 | while (my ($htype, $id) = each %$disable) { |
|
|
1092 | delete $self->{_hook}[$htype]{$id}; |
|
|
1093 | $self->set_should_invoke ($htype, -1); |
|
|
1094 | } |
|
|
1095 | } |
|
|
1096 | |
|
|
1097 | sub on { |
|
|
1098 | my ($self, %hook) = @_; |
|
|
1099 | |
|
|
1100 | my %disable = ( "" => $self ); |
|
|
1101 | |
|
|
1102 | while (my ($name, $cb) = each %hook) { |
|
|
1103 | my $htype = $HOOKTYPE{uc $name}; |
|
|
1104 | defined $htype |
|
|
1105 | or Carp::croak "unsupported hook type '$name'"; |
|
|
1106 | |
|
|
1107 | my $id = $cb+0; |
|
|
1108 | |
|
|
1109 | $self->set_should_invoke ($htype, +1); |
|
|
1110 | $disable{$htype} = $id; |
|
|
1111 | $self->{_hook}[$htype]{$id} = $cb; |
|
|
1112 | } |
|
|
1113 | |
|
|
1114 | bless \%disable, "urxvt::term::on_disable" |
|
|
1115 | } |
|
|
1116 | |
1063 | =item $term->exec_async ($cmd[, @args]) |
1117 | =item $term->exec_async ($cmd[, @args]) |
1064 | |
1118 | |
1065 | Works like the combination of the C<fork>/C<exec> builtins, which executes |
1119 | Works like the combination of the C<fork>/C<exec> builtins, which executes |
1066 | ("starts") programs in the background. This function takes care of setting |
1120 | ("starts") programs in the background. This function takes care of setting |
1067 | the user environment before exec'ing the command (e.g. C<PATH>) and should |
1121 | the user environment before exec'ing the command (e.g. C<PATH>) and should |
… | |
… | |
1121 | |
1175 | |
1122 | Here is a likely non-exhaustive list of resource names, not all of which |
1176 | Here is a likely non-exhaustive list of resource names, not all of which |
1123 | are supported in every build, please see the source file F</src/rsinc.h> |
1177 | are supported in every build, please see the source file F</src/rsinc.h> |
1124 | to see the actual list: |
1178 | to see the actual list: |
1125 | |
1179 | |
1126 | answerbackstring backgroundPixmap backspace_key blendtype blurradius |
1180 | answerbackstring backgroundPixmap backspace_key blurradius |
1127 | boldFont boldItalicFont borderLess buffered chdir color cursorBlink |
1181 | boldFont boldItalicFont borderLess buffered chdir color cursorBlink |
1128 | cursorUnderline cutchars delete_key depth display_name embed ext_bwidth |
1182 | cursorUnderline cutchars delete_key depth display_name embed ext_bwidth |
1129 | fade font geometry hold iconName iconfile imFont imLocale inputMethod |
1183 | fade font geometry hold iconName iconfile imFont imLocale inputMethod |
1130 | insecure int_bwidth intensityStyles iso14755 iso14755_52 italicFont |
1184 | insecure int_bwidth intensityStyles iso14755 iso14755_52 italicFont |
1131 | jumpScroll letterSpace lineSpace loginShell mapAlert meta8 modifier |
1185 | jumpScroll letterSpace lineSpace loginShell mapAlert meta8 modifier |
… | |
… | |
1156 | Extensions that define extra resource or command line arguments also need |
1210 | Extensions that define extra resource or command line arguments also need |
1157 | to call this method to access their values. |
1211 | to call this method to access their values. |
1158 | |
1212 | |
1159 | If the method is called on an extension object (basically, from an |
1213 | If the method is called on an extension object (basically, from an |
1160 | extension), then the special prefix C<%.> will be replaced by the name of |
1214 | extension), then the special prefix C<%.> will be replaced by the name of |
1161 | the extension and a dot, and the lone string C<%> will be replcaed by the |
1215 | the extension and a dot, and the lone string C<%> will be replaced by the |
1162 | extension name itself. This makes it possible to code extensions so you |
1216 | extension name itself. This makes it possible to code extensions so you |
1163 | can rename them and get a new set of commandline switches and resources |
1217 | can rename them and get a new set of commandline switches and resources |
1164 | without having to change the actual code. |
1218 | without having to change the actual code. |
1165 | |
1219 | |
1166 | This method should only be called during the C<on_start> hook, as there is |
1220 | This method should only be called during the C<on_start> hook, as there is |