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.144 by root, Mon Aug 7 15:59:44 2006 UTC vs.
Revision 1.152 by tpope, Tue Jan 9 16:18:56 2007 UTC

240 URxvt.tabbed.tab-bg: <colour-index, default 1> 240 URxvt.tabbed.tab-bg: <colour-index, default 1>
241 241
242See I<COLOR AND GRAPHICS> in the @@RXVT_NAME@@(1) manpage for valid 242See I<COLOR AND GRAPHICS> in the @@RXVT_NAME@@(1) manpage for valid
243indices. 243indices.
244 244
245=item mark-urls 245=item matcher
246 246
247Uses per-line display filtering (C<on_line_update>) to underline urls and 247Uses per-line display filtering (C<on_line_update>) to underline text
248make them clickable. When middle-clicked, the program specified in the 248matching a certain pattern and make it clickable. When clicked with the
249resource C<urlLauncher> (default C<x-www-browser>) will be started with 249mouse button specified in the C<matcher.button> resource (default 2, or
250the URL as first argument. 250middle), the program specified in the C<matcher.launcher> resource
251(default, the C<urlLauncher> resource, C<sensible-browser>) will be started
252with the matched text as first argument. The default configuration is
253suitable for matching URLs and launching a web browser, like the
254former "mark-urls" extension.
255
256The default pattern to match URLs can be overridden with the
257C<matcher.pattern.0> resource, and additional patterns can be specified
258with numbered patterns, in a manner similar to the "selection" extension.
259The launcher can also be overridden on a per-pattern basis.
260
261Example configuration:
262
263 URxvt.perl-ext: default,matcher
264 URxvt.urlLauncher: sensible-browser
265 URxvt.keysym.C-Delete: perl:matcher
266 URxvt.matcher.button: 1
267 URxvt.matcher.pattern.1: \\bwww\\.[\\w-]+\\.[\\w./?&@#-]*[\\w/-]
268 URxvt.matcher.pattern.2: \\B(/\\S+?):(\\d+)(?=:|$)
269 URxvt.matcher.launcher.2: gvim +$2 $1
251 270
252=item xim-onthespot 271=item xim-onthespot
253 272
254This (experimental) perl extension implements OnTheSpot editing. It does 273This (experimental) perl extension implements OnTheSpot editing. It does
255not work perfectly, and some input methods don't seem to work well with 274not work perfectly, and some input methods don't seem to work well with
346in the C<selection-pastebin-url> resource (again, the % is the placeholder 365in the C<selection-pastebin-url> resource (again, the % is the placeholder
347for the filename): 366for the filename):
348 367
349 URxvt.selection-pastebin.url: http://www.ta-sa.org/files/txt/% 368 URxvt.selection-pastebin.url: http://www.ta-sa.org/files/txt/%
350 369
370I<Note to xrdb users:> xrdb uses the C preprocessor, which might interpret
371the double C</> characters as comment start. Use C<\057\057> instead,
372which works regardless of wether xrdb is used to parse the resource file
373or not.
374
351=item example-refresh-hooks 375=item example-refresh-hooks
352 376
353Displays a very simple digital clock in the upper right corner of the 377Displays a very simple digital clock in the upper right corner of the
354window. Illustrates overwriting the refresh callbacks to create your own 378window. Illustrates overwriting the refresh callbacks to create your own
355overlays or changes. 379overlays or changes.
395=back 419=back
396 420
397=head2 Extension Objects 421=head2 Extension Objects
398 422
399Every perl extension is a perl class. A separate perl object is created 423Every perl extension is a perl class. A separate perl object is created
400for each terminal and each extension and passed as the first parameter to 424for each terminal, and each terminal has its own set of extenion objects,
401hooks. So extensions can use their C<$self> object without having to think 425which are passed as the first parameter to hooks. So extensions can use
402about other extensions, with the exception of methods and members that 426their C<$self> object without having to think about clashes with other
427extensions or other terminals, with the exception of methods and members
403begin with an underscore character C<_>: these are reserved for internal 428that begin with an underscore character C<_>: these are reserved for
404use. 429internal use.
405 430
406Although it isn't a C<urxvt::term> object, you can call all methods of the 431Although it isn't a C<urxvt::term> object, you can call all methods of the
407C<urxvt::term> class on this object. 432C<urxvt::term> class on this object.
408 433
409It has the following methods and data members: 434It has the following methods and data members:
966 991
967sub SET_COLOR($$$) { 992sub SET_COLOR($$$) {
968 SET_BGCOLOR (SET_FGCOLOR ($_[0], $_[1]), $_[2]) 993 SET_BGCOLOR (SET_FGCOLOR ($_[0], $_[1]), $_[2])
969} 994}
970 995
996sub rend2mask {
997 no strict 'refs';
998 my ($str, $mask) = (@_, 0);
999 my %color = ( fg => undef, bg => undef );
1000 my @failed;
1001 for my $spec ( split /\s+/, $str ) {
1002 if ( $spec =~ /^([fb]g)[_:-]?(\d+)/i ) {
1003 $color{lc($1)} = $2;
1004 } else {
1005 my $neg = $spec =~ s/^[-^]//;
1006 unless ( exists &{"RS_$spec"} ) {
1007 push @failed, $spec;
1008 next;
1009 }
1010 my $cur = &{"RS_$spec"};
1011 if ( $neg ) {
1012 $mask &= ~$cur;
1013 } else {
1014 $mask |= $cur;
1015 }
1016 }
1017 }
1018 ($mask, @color{qw(fg bg)}, \@failed)
1019}
1020
971# urxvt::term::extension 1021# urxvt::term::extension
972 1022
973package urxvt::term::extension; 1023package urxvt::term::extension;
974 1024
975sub enable { 1025sub enable {
1086sub DESTROY { 1136sub DESTROY {
1087 $_[0][1]->stop; 1137 $_[0][1]->stop;
1088} 1138}
1089 1139
1090sub condvar { 1140sub condvar {
1091 bless \my $flag, urxvt::anyevent::condvar:: 1141 bless \my $flag, urxvt::anyevent::
1092} 1142}
1093 1143
1094sub urxvt::anyevent::condvar::broadcast { 1144sub broadcast {
1095 ${$_[0]}++; 1145 ${$_[0]}++;
1096} 1146}
1097 1147
1098sub urxvt::anyevent::condvar::wait { 1148sub wait {
1099 unless (${$_[0]}) { 1149 unless (${$_[0]}) {
1100 Carp::croak "AnyEvent->condvar blocking wait unsupported in urxvt, use a non-blocking API"; 1150 Carp::croak "AnyEvent->condvar blocking wait unsupported in urxvt, use a non-blocking API";
1101 } 1151 }
1152}
1153
1154sub one_event {
1155 Carp::croak "AnyEvent->one_event blocking wait unsupported in urxvt, use a non-blocking API";
1102} 1156}
1103 1157
1104package urxvt::term; 1158package urxvt::term;
1105 1159
1106=head2 The C<urxvt::term> Class 1160=head2 The C<urxvt::term> Class
1926 1980
1927=cut 1981=cut
1928 1982
1929package urxvt::watcher; 1983package urxvt::watcher;
1930 1984
1931@urxvt::timer::ISA = __PACKAGE__;
1932@urxvt::iow::ISA = __PACKAGE__;
1933@urxvt::pw::ISA = __PACKAGE__;
1934@urxvt::iw::ISA = __PACKAGE__;
1935
1936=head2 The C<urxvt::timer> Class 1985=head2 The C<urxvt::timer> Class
1937 1986
1938This class implements timer watchers/events. Time is represented as a 1987This class implements timer watchers/events. Time is represented as a
1939fractional number of seconds since the epoch. Example: 1988fractional number of seconds since the epoch. Example:
1940 1989
2125 http://software.schmorp.de/pkg/rxvt-unicode 2174 http://software.schmorp.de/pkg/rxvt-unicode
2126 2175
2127=cut 2176=cut
2128 2177
21291 21781
2179
2180# vim: sw=3:

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines