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.73 by root, Tue Jan 10 04:23:39 2006 UTC vs.
Revision 1.76 by root, Tue Jan 10 19:46:28 2006 UTC

26thus must be encoded as UTF-8. 26thus must be encoded as UTF-8.
27 27
28Each script will only ever be loaded once, even in @@RXVT_NAME@@d, where 28Each script will only ever be loaded once, even in @@RXVT_NAME@@d, where
29scripts will be shared (but not enabled) for all terminals. 29scripts will be shared (but not enabled) for all terminals.
30 30
31=head2 Prepackaged Extensions 31=head1 PREPACKAGED EXTENSIONS
32 32
33This section describes the extensiosn delivered with this version. You can 33This section describes the extensions delivered with this release. You can
34find them in F<@@RXVT_LIBDIR@@/urxvt/perl/>. 34find them in F<@@RXVT_LIBDIR@@/urxvt/perl/>.
35 35
36You can activate them like this: 36You can activate them like this:
37 37
38 @@RXVT_NAME@@ -pe <extensionname> 38 @@RXVT_NAME@@ -pe <extensionname>
39 39
40=over 4 40=over 4
41 41
42=item selection (enabled by default) 42=item selection (enabled by default)
43 43
44Intelligent selection. This extension tries to be more intelligent when 44(More) intelligent selection. This extension tries to be more intelligent
45the user extends selections (double-click). Right now, it tries to select 45when the user extends selections (double-click). Right now, it tries to
46urls and complete shell-quoted arguments, which is very convenient, too, 46select urls and complete shell-quoted arguments, which is very convenient,
47if your F<ls> supports C<--quoting-style=shell>. 47too, if your F<ls> supports C<--quoting-style=shell>.
48 48
49It also offers the following bindable event: 49It also offers the following bindable keyboard command:
50 50
51=over 4 51=over 4
52 52
53=item rot13 53=item rot13
54 54
64runtime. 64runtime.
65 65
66=item selection-popup (enabled by default) 66=item selection-popup (enabled by default)
67 67
68Binds a popup menu to Ctrl-Button3 that lets you convert the selection 68Binds a popup menu to Ctrl-Button3 that lets you convert the selection
69text into various other formats/action. 69text into various other formats/action (such as uri unescaping, perl
70evalution, web-browser starting etc.), depending on content.
70 71
71=item searchable-scrollback (enabled by default) 72=item searchable-scrollback<hotkey> (enabled by default)
72 73
73Adds regex search functionality to the scrollback buffer, triggered by a 74Adds regex search functionality to the scrollback buffer, triggered
74hotkey (default: C<M-s>). When in search mode, terminal input/output is 75by a hotkey (default: C<M-s>). When in search mode, normal terminal
76input/output is suspended.
77
75suspended, C</> starts an incremental regex search, C<n> searches further, 78C</> starts an incremental regex search, C<n> searches further, C<p> or
76C<p> jumps to the previous match. C<enter> leaves search mode at the 79C<N> jump to the previous match, C<G> jumps to the bottom and clears the
77current position and C<escape> returns to the original position. 80history, C<enter> leaves search mode at the current position and C<escape>
81returns to the original position.
78 82
79=item digital-clock 83=item digital-clock
80 84
81Displays a digital clock using the built-in overlay. 85Displays a digital clock using the built-in overlay.
82 86
95Displays a very simple digital clock in the upper right corner of the 99Displays a very simple digital clock in the upper right corner of the
96window. Illustrates overwriting the refresh callbacks to create your own 100window. Illustrates overwriting the refresh callbacks to create your own
97overlays or changes. 101overlays or changes.
98 102
99=back 103=back
104
105=head1 API DOCUMENTATION
100 106
101=head2 General API Considerations 107=head2 General API Considerations
102 108
103All objects (such as terminals, time watchers etc.) are typical 109All objects (such as terminals, time watchers etc.) are typical
104reference-to-hash objects. The hash can be used to store anything you 110reference-to-hash objects. The hash can be used to store anything you
341 347
342=head2 Variables in the C<urxvt> Package 348=head2 Variables in the C<urxvt> Package
343 349
344=over 4 350=over 4
345 351
352=item $urxvt::LIBDIR
353
354The rxvt-unicode library directory, where, among other things, the perl
355modules and scripts are stored.
356
357=item $urxvt::RESCLASS, $urxvt::RESCLASS
358
359The resource class and name rxvt-unicode uses to look up X resources.
360
361=item $urxvt::RXVTNAME
362
363The basename of the installed binaries, usually C<urxvt>.
364
346=item $urxvt::TERM 365=item $urxvt::TERM
347 366
348The current terminal. This variable stores the current C<urxvt::term> 367The current terminal. This variable stores the current C<urxvt::term>
349object, whenever a callback/hook is executing. 368object, whenever a callback/hook is executing.
369
370=item
350 371
351=back 372=back
352 373
353=head2 Functions in the C<urxvt> Package 374=head2 Functions in the C<urxvt> Package
354 375
428 449
429=item $background = urxvt::GET_BASEBG $rend 450=item $background = urxvt::GET_BASEBG $rend
430 451
431Return the foreground/background colour index, respectively. 452Return the foreground/background colour index, respectively.
432 453
433=item $rend = urxvt::SET_FGCOLOR ($rend, $new_colour) 454=item $rend = urxvt::SET_FGCOLOR $rend, $new_colour
434 455
435=item $rend = urxvt::SET_BGCOLOR ($rend, $new_colour) 456=item $rend = urxvt::SET_BGCOLOR $rend, $new_colour
436 457
437Replace the foreground/background colour in the rendition mask with the 458Replace the foreground/background colour in the rendition mask with the
438specified one. 459specified one.
439 460
440=item $value = urxvt::GET_CUSTOM ($rend) 461=item $value = urxvt::GET_CUSTOM $rend
441 462
442Return the "custom" value: Every rendition has 5 bits for use by 463Return the "custom" value: Every rendition has 5 bits for use by
443extensions. They can be set and changed as you like and are initially 464extensions. They can be set and changed as you like and are initially
444zero. 465zero.
445 466
446=item $rend = urxvt::SET_CUSTOM ($rend, $new_value) 467=item $rend = urxvt::SET_CUSTOM $rend, $new_value
447 468
448Change the custom value. 469Change the custom value.
449 470
450=back 471=back
451 472
672 693
673=head2 The C<urxvt::anyevent> Class 694=head2 The C<urxvt::anyevent> Class
674 695
675The sole purpose of this class is to deliver an interface to the 696The sole purpose of this class is to deliver an interface to the
676C<AnyEvent> module - any module using it will work inside urxvt without 697C<AnyEvent> module - any module using it will work inside urxvt without
677further work. The only exception is that you cannot wait on condition 698further programming. The only exception is that you cannot wait on
678variables, but non-blocking condvar use is ok. What this means is that you 699condition variables, but non-blocking condvar use is ok. What this means
679cannot use blocking APIs, but the non-blocking variant should work. 700is that you cannot use blocking APIs, but the non-blocking variant should
701work.
680 702
681=cut 703=cut
682 704
683our $VERSION = 1; 705our $VERSION = 1;
684 706
763 } 785 }
764} 786}
765 787
766=item $term->destroy 788=item $term->destroy
767 789
768Destroy the terminal object (close the window, free resources etc.). 790Destroy the terminal object (close the window, free resources
791etc.). Please note that @@RXVT_NAME@@ will not exit as long as any event
792watchers (timers, io watchers) are still active.
769 793
770=item $isset = $term->option ($optval[, $set]) 794=item $isset = $term->option ($optval[, $set])
771 795
772Returns true if the option specified by C<$optval> is enabled, and 796Returns true if the option specified by C<$optval> is enabled, and
773optionally change it. All option values are stored by name in the hash 797optionally change it. All option values are stored by name in the hash
1287 $item->{render} ||= sub { $_[0]{text} }; 1311 $item->{render} ||= sub { $_[0]{text} };
1288 1312
1289 push @{ $self->{item} }, $item; 1313 push @{ $self->{item} }, $item;
1290} 1314}
1291 1315
1316=item $popup->add_title ($title)
1317
1318Adds a non-clickable title to the popup.
1319
1320=cut
1321
1322sub add_title {
1323 my ($self, $title) = @_;
1324
1325 $self->add_item ({
1326 rend => { normal => "\x1b[38;5;11;44m", hover => "\x1b[38;5;11;44m", active => "\x1b[38;5;11;44m" },
1327 text => $title,
1328 activate => sub { },
1329 });
1330}
1331
1332=item $popup->add_separator ([$sepchr])
1333
1334Creates a separator, optionally using the character given as C<$sepchr>.
1335
1336=cut
1337
1292sub add_separator { 1338sub add_separator {
1293 my ($self, $sep) = @_; 1339 my ($self, $sep) = @_;
1294 1340
1295 $sep ||= "="; 1341 $sep ||= "=";
1296 1342
1300 render => sub { $sep x $self->{term}->ncol }, 1346 render => sub { $sep x $self->{term}->ncol },
1301 activate => sub { }, 1347 activate => sub { },
1302 }); 1348 });
1303} 1349}
1304 1350
1305sub add_title { 1351=item $popup->add_button ($text, $cb)
1306 my ($self, $title) = @_;
1307 1352
1308 $self->add_item ({ 1353Adds a clickable button to the popup. C<$cb> is called whenever it is
1309 rend => { normal => "\x1b[38;5;11;44m", hover => "\x1b[38;5;11;44m", active => "\x1b[38;5;11;44m" }, 1354selected.
1310 text => $title, 1355
1311 activate => sub { }, 1356=cut
1312 });
1313}
1314 1357
1315sub add_button { 1358sub add_button {
1316 my ($self, $text, $cb) = @_; 1359 my ($self, $text, $cb) = @_;
1317 1360
1318 $self->add_item ({ type => "button", text => $text, activate => $cb}); 1361 $self->add_item ({ type => "button", text => $text, activate => $cb});
1319} 1362}
1363
1364=item $popup->add_toggle ($text, $cb, $initial_value)
1365
1366Adds a toggle/checkbox item to the popup. Teh callback gets called
1367whenever it gets toggled, with a boolean indicating its value as its first
1368argument.
1369
1370=cut
1320 1371
1321sub add_toggle { 1372sub add_toggle {
1322 my ($self, $text, $cb, $value) = @_; 1373 my ($self, $text, $cb, $value) = @_;
1323 1374
1324 my $item; $item = { 1375 my $item; $item = {
1325 type => "button", 1376 type => "button",
1326 text => " $text", 1377 text => " $text",
1327 value => $value, 1378 value => $value,
1328 render => sub { ($_[0]{value} ? "* " : " ") . $text }, 1379 render => sub { ($_[0]{value} ? "* " : " ") . $text },
1329 activate => sub { $cb->($_[0]{value} = !$_[0]{value}); }, 1380 activate => sub { $cb->($_[1]{value} = !$_[1]{value}); },
1330 }; 1381 };
1331 1382
1332 $self->add_item ($item); 1383 $self->add_item ($item);
1333} 1384}
1385
1386=item $popup->show
1387
1388Displays the popup (which is initially hidden).
1389
1390=cut
1334 1391
1335sub show { 1392sub show {
1336 my ($self) = @_; 1393 my ($self) = @_;
1337 1394
1338 local $urxvt::popup::self = $self; 1395 local $urxvt::popup::self = $self;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines