1 | #! perl |
1 | #! perl |
|
|
2 | |
|
|
3 | sub on_start { |
|
|
4 | my ($self) = @_; |
|
|
5 | |
|
|
6 | $self->grab_button (2, urxvt::ControlMask); |
|
|
7 | |
|
|
8 | () |
|
|
9 | } |
2 | |
10 | |
3 | sub on_button_press { |
11 | sub on_button_press { |
4 | my ($self, $event) = @_; |
12 | my ($self, $event) = @_; |
5 | |
13 | |
6 | if ($event->{button} == 3 && $event->{state} & urxvt::ControlMask) { |
14 | if ($event->{button} == 2 && $event->{state} & urxvt::ControlMask) { |
7 | my $popup = $self->popup ($event); |
15 | my $popup = $self->popup ($event) |
|
|
16 | or return 1; |
|
|
17 | |
|
|
18 | $popup->add_title ("Options"); |
|
|
19 | $popup->add_separator; |
8 | |
20 | |
9 | my %unsafe = map +($_ => 1), |
21 | my %unsafe = map +($_ => 1), |
10 | qw(borderLess console iconic loginShell reverseVideo |
22 | qw(borderLess console iconic loginShell reverseVideo |
11 | scrollBar scrollBar_floating scrollBar_right |
23 | scrollBar scrollBar_floating scrollBar_right |
12 | secondaryScreen transparent utmpInhibit meta8); |
24 | secondaryScreen transparent utmpInhibit meta8 |
|
|
25 | override_redirect); |
13 | |
26 | |
14 | for my $name (sort keys %urxvt::OPTION) { |
27 | for my $name (sort keys %urxvt::OPTION) { |
15 | next if $unsafe{$name}; |
28 | next if $unsafe{$name}; |
16 | |
29 | |
17 | my $optval = $urxvt::OPTION{$name}; |
30 | my $optval = $urxvt::OPTION{$name}; |
18 | |
31 | |
19 | $popup->add_toggle ($name => sub { $self->option ($optval, $_[0]) }, |
32 | $popup->add_toggle ($name => $self->option ($optval), |
20 | $self->option ($optval)); |
33 | sub { $self->option ($optval, $_[0]) }); |
|
|
34 | } |
|
|
35 | |
|
|
36 | for my $hook (@{ $self->{term}{option_popup_hook} || [] }) { |
|
|
37 | if (my ($name, $value, $cb) = $hook->($popup)) { |
|
|
38 | $popup->add_toggle ($name => $value, sub { $cb->($_[0]) }); |
|
|
39 | } |
|
|
40 | } |
|
|
41 | |
|
|
42 | { |
|
|
43 | $popup->add_separator; |
|
|
44 | my $locale = $self->locale; |
|
|
45 | $locale =~ y/\x20-\x7e//cd; |
|
|
46 | $popup->add_title ("Locale: $locale"); |
21 | } |
47 | } |
22 | |
48 | |
23 | $popup->show; |
49 | $popup->show; |
24 | |
50 | |
25 | return 1; |
51 | return 1; |