… | |
… | |
404 | use Scalar::Util (); |
404 | use Scalar::Util (); |
405 | use List::Util (); |
405 | use List::Util (); |
406 | |
406 | |
407 | our $TERM; |
407 | our $TERM; |
408 | our @HOOKNAME; |
408 | our @HOOKNAME; |
|
|
409 | our %OPTION; |
409 | our $LIBDIR; |
410 | our $LIBDIR; |
410 | |
411 | |
411 | BEGIN { |
412 | BEGIN { |
412 | urxvt->bootstrap; |
413 | urxvt->bootstrap; |
413 | |
414 | |
… | |
… | |
479 | local $TERM = shift; |
480 | local $TERM = shift; |
480 | my $htype = shift; |
481 | my $htype = shift; |
481 | |
482 | |
482 | if ($htype == 0) { # INIT |
483 | if ($htype == 0) { # INIT |
483 | my @dirs = ((split /:/, $TERM->resource ("perl_lib")), "$LIBDIR/perl"); |
484 | my @dirs = ((split /:/, $TERM->resource ("perl_lib")), "$LIBDIR/perl"); |
|
|
485 | |
|
|
486 | my %want_ext; |
484 | |
487 | |
485 | for my $ext (map { split /,/, $TERM->resource ("perl_ext_$_") } 1, 2) { |
488 | for (map { split /,/, $TERM->resource ("perl_ext_$_") } 1, 2) { |
|
|
489 | if ($_ eq "default") { |
|
|
490 | $want_ext{$_}++ for qw(selection option-popup); |
|
|
491 | } elsif (/^-(.*)$/) { |
|
|
492 | delete $want_ext{$1}; |
|
|
493 | } else { |
|
|
494 | $want_ext{$_}++; |
|
|
495 | } |
|
|
496 | } |
|
|
497 | |
|
|
498 | for my $ext (keys %want_ext) { |
486 | my @files = grep -f $_, map "$_/$ext", @dirs; |
499 | my @files = grep -f $_, map "$_/$ext", @dirs; |
487 | |
500 | |
488 | if (@files) { |
501 | if (@files) { |
489 | register_package extension_package $files[0]; |
502 | register_package extension_package $files[0]; |
490 | } else { |
503 | } else { |
… | |
… | |
564 | |
577 | |
565 | =item $term->destroy |
578 | =item $term->destroy |
566 | |
579 | |
567 | Destroy the terminal object (close the window, free resources etc.). |
580 | Destroy the terminal object (close the window, free resources etc.). |
568 | |
581 | |
|
|
582 | =item $isset = $term->option ($optval[, $set]) |
|
|
583 | |
|
|
584 | Returns true if the option specified by C<$optval> is enabled, and |
|
|
585 | optionally change it. All option values are stored by name in the hash |
|
|
586 | C<%urxvt::OPTION>. Options not enabled in this binary are not in the hash. |
|
|
587 | |
|
|
588 | Here is a a likely non-exhaustive list of option names, please see the |
|
|
589 | source file F</src/optinc.h> to see the actual list: |
|
|
590 | |
|
|
591 | borderLess console cursorBlink cursorUnderline hold iconic insecure |
|
|
592 | intensityStyles jumpScroll loginShell mapAlert meta8 mouseWheelScrollPage |
|
|
593 | pastableTabs pointerBlank reverseVideo scrollBar scrollBar_floating |
|
|
594 | scrollBar_right scrollTtyKeypress scrollTtyOutput scrollWithBuffer |
|
|
595 | secondaryScreen secondaryScroll skipBuiltinGlyphs transparent |
|
|
596 | tripleclickwords utmpInhibit visualBell |
|
|
597 | |
569 | =item $value = $term->resource ($name[, $newval]) |
598 | =item $value = $term->resource ($name[, $newval]) |
570 | |
599 | |
571 | Returns the current resource value associated with a given name and |
600 | Returns the current resource value associated with a given name and |
572 | optionally sets a new value. Setting values is most useful in the C<init> |
601 | optionally sets a new value. Setting values is most useful in the C<init> |
573 | hook. Unset resources are returned and accepted as C<undef>. |
602 | hook. Unset resources are returned and accepted as C<undef>. |
… | |
… | |
582 | |
611 | |
583 | Please note that resource strings will currently only be freed when the |
612 | Please note that resource strings will currently only be freed when the |
584 | terminal is destroyed, so changing options frequently will eat memory. |
613 | terminal is destroyed, so changing options frequently will eat memory. |
585 | |
614 | |
586 | Here is a a likely non-exhaustive list of resource names, not all of which |
615 | Here is a a likely non-exhaustive list of resource names, not all of which |
587 | are supported in every build, please see the source to see the actual |
616 | are supported in every build, please see the source file F</src/rsinc.h> |
588 | list: |
617 | to see the actual list: |
589 | |
618 | |
590 | answerbackstring backgroundPixmap backspace_key boldFont boldItalicFont |
619 | answerbackstring backgroundPixmap backspace_key boldFont boldItalicFont |
591 | borderLess color cursorBlink cursorUnderline cutchars delete_key |
620 | borderLess color cursorBlink cursorUnderline cutchars delete_key |
592 | display_name embed ext_bwidth fade font geometry hold iconName |
621 | display_name embed ext_bwidth fade font geometry hold iconName |
593 | imFont imLocale inputMethod insecure int_bwidth intensityStyles |
622 | imFont imLocale inputMethod insecure int_bwidth intensityStyles |
… | |
… | |
996 | package urxvt::popup; |
1025 | package urxvt::popup; |
997 | |
1026 | |
998 | sub add_item { |
1027 | sub add_item { |
999 | my ($self, $item) = @_; |
1028 | my ($self, $item) = @_; |
1000 | |
1029 | |
|
|
1030 | $item->{rend}{normal} = "\x1b[0;30;47m" unless exists $item->{rend}{normal}; |
|
|
1031 | $item->{rend}{hover} = "\x1b[0;30;46m" unless exists $item->{rend}{hover}; |
|
|
1032 | $item->{rend}{active} = "\x1b[m" unless exists $item->{rend}{active}; |
|
|
1033 | |
|
|
1034 | $item->{render} ||= sub { $_[0]{text} }; |
|
|
1035 | |
1001 | push @{ $self->{item} }, $item; |
1036 | push @{ $self->{item} }, $item; |
|
|
1037 | } |
|
|
1038 | |
|
|
1039 | sub add_separator { |
|
|
1040 | my ($self, $sep) = @_; |
|
|
1041 | |
|
|
1042 | $sep ||= "═"; |
|
|
1043 | |
|
|
1044 | $self->add_item ({ |
|
|
1045 | rend => { normal => "\x1b[0;30;47m", hover => "\x1b[0;30;47m", active => "\x1b[0;30;47m" }, |
|
|
1046 | text => "", |
|
|
1047 | render => sub { $sep x $urxvt::TERM->ncol }, |
|
|
1048 | activate => sub { }, |
|
|
1049 | }); |
|
|
1050 | } |
|
|
1051 | |
|
|
1052 | sub add_title { |
|
|
1053 | my ($self, $title) = @_; |
|
|
1054 | |
|
|
1055 | $self->add_item ({ |
|
|
1056 | rend => { normal => "\x1b[38;5;11;44m", hover => "\x1b[38;5;11;44m", active => "\x1b[38;5;11;44m" }, |
|
|
1057 | text => $title, |
|
|
1058 | activate => sub { }, |
|
|
1059 | }); |
1002 | } |
1060 | } |
1003 | |
1061 | |
1004 | sub add_button { |
1062 | sub add_button { |
1005 | my ($self, $text, $cb) = @_; |
1063 | my ($self, $text, $cb) = @_; |
1006 | |
1064 | |
1007 | $self->add_item ({ type => "button", text => "[ $text ]", activate => $cb, |
1065 | $self->add_item ({ type => "button", text => "[ $text ]", activate => $cb}); |
1008 | render => sub { $_[0]{text} }, |
|
|
1009 | }); |
|
|
1010 | } |
1066 | } |
1011 | |
1067 | |
1012 | sub add_toggle { |
1068 | sub add_toggle { |
1013 | my ($self, $text, $cb, $value) = @_; |
1069 | my ($self, $text, $cb, $value) = @_; |
1014 | |
1070 | |
1015 | $self->add_item ({ type => "button", text => " $text", value => $value, |
1071 | my $item; $item = { |
|
|
1072 | type => "button", |
|
|
1073 | text => " $text", |
|
|
1074 | value => $value, |
1016 | render => sub { ($_[0]{value} ? "✔" : " ") . substr $_[0]{text}, 1 }, |
1075 | render => sub { ($item->{value} ? "* " : " ") . $text }, |
1017 | activate => sub { $cb->($_[0]{value} = !$_[0]{value}); }, |
1076 | activate => sub { $cb->($item->{value} = !$item->{value}); }, |
1018 | }); |
1077 | }; |
|
|
1078 | |
|
|
1079 | $self->add_item ($item); |
1019 | } |
1080 | } |
1020 | |
1081 | |
1021 | sub show { |
1082 | sub show { |
1022 | my ($self) = @_; |
1083 | my ($self) = @_; |
1023 | |
1084 | |