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.72 by root, Mon Jan 9 23:30:01 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
462our $VERSION = 1; 483our $VERSION = 1;
463our $TERM; 484our $TERM;
464our @HOOKNAME; 485our @HOOKNAME;
465our %HOOKTYPE = map +($HOOKNAME[$_] => $_), 0..$#HOOKNAME; 486our %HOOKTYPE = map +($HOOKNAME[$_] => $_), 0..$#HOOKNAME;
466our %OPTION; 487our %OPTION;
488
467our $LIBDIR; 489our $LIBDIR;
490our $RESNAME;
491our $RESCLASS;
492our $RXVTNAME;
468 493
469BEGIN { 494BEGIN {
470 urxvt->bootstrap; 495 urxvt->bootstrap;
471 496
472 # overwrite perl's warn 497 # overwrite perl's warn
668 693
669=head2 The C<urxvt::anyevent> Class 694=head2 The C<urxvt::anyevent> Class
670 695
671The 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
672C<AnyEvent> module - any module using it will work inside urxvt without 697C<AnyEvent> module - any module using it will work inside urxvt without
673further work. The only exception is that you cannot wait on condition 698further programming. The only exception is that you cannot wait on
674variables, 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
675cannot use blocking APIs, but the non-blocking variant should work. 700is that you cannot use blocking APIs, but the non-blocking variant should
701work.
676 702
677=cut 703=cut
678 704
679our $VERSION = 1; 705our $VERSION = 1;
680 706
759 } 785 }
760} 786}
761 787
762=item $term->destroy 788=item $term->destroy
763 789
764Destroy 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.
765 793
766=item $isset = $term->option ($optval[, $set]) 794=item $isset = $term->option ($optval[, $set])
767 795
768Returns true if the option specified by C<$optval> is enabled, and 796Returns true if the option specified by C<$optval> is enabled, and
769optionally 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
1283 $item->{render} ||= sub { $_[0]{text} }; 1311 $item->{render} ||= sub { $_[0]{text} };
1284 1312
1285 push @{ $self->{item} }, $item; 1313 push @{ $self->{item} }, $item;
1286} 1314}
1287 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
1288sub add_separator { 1338sub add_separator {
1289 my ($self, $sep) = @_; 1339 my ($self, $sep) = @_;
1290 1340
1291 $sep ||= "="; 1341 $sep ||= "=";
1292 1342
1296 render => sub { $sep x $self->{term}->ncol }, 1346 render => sub { $sep x $self->{term}->ncol },
1297 activate => sub { }, 1347 activate => sub { },
1298 }); 1348 });
1299} 1349}
1300 1350
1301sub add_title { 1351=item $popup->add_button ($text, $cb)
1302 my ($self, $title) = @_;
1303 1352
1304 $self->add_item ({ 1353Adds a clickable button to the popup. C<$cb> is called whenever it is
1305 rend => { normal => "\x1b[38;5;11;44m", hover => "\x1b[38;5;11;44m", active => "\x1b[38;5;11;44m" }, 1354selected.
1306 text => $title, 1355
1307 activate => sub { }, 1356=cut
1308 });
1309}
1310 1357
1311sub add_button { 1358sub add_button {
1312 my ($self, $text, $cb) = @_; 1359 my ($self, $text, $cb) = @_;
1313 1360
1314 $self->add_item ({ type => "button", text => $text, activate => $cb}); 1361 $self->add_item ({ type => "button", text => $text, activate => $cb});
1315} 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
1316 1371
1317sub add_toggle { 1372sub add_toggle {
1318 my ($self, $text, $cb, $value) = @_; 1373 my ($self, $text, $cb, $value) = @_;
1319 1374
1320 my $item; $item = { 1375 my $item; $item = {
1321 type => "button", 1376 type => "button",
1322 text => " $text", 1377 text => " $text",
1323 value => $value, 1378 value => $value,
1324 render => sub { ($_[0]{value} ? "* " : " ") . $text }, 1379 render => sub { ($_[0]{value} ? "* " : " ") . $text },
1325 activate => sub { $cb->($_[0]{value} = !$_[0]{value}); }, 1380 activate => sub { $cb->($_[1]{value} = !$_[1]{value}); },
1326 }; 1381 };
1327 1382
1328 $self->add_item ($item); 1383 $self->add_item ($item);
1329} 1384}
1385
1386=item $popup->show
1387
1388Displays the popup (which is initially hidden).
1389
1390=cut
1330 1391
1331sub show { 1392sub show {
1332 my ($self) = @_; 1393 my ($self) = @_;
1333 1394
1334 local $urxvt::popup::self = $self; 1395 local $urxvt::popup::self = $self;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines