… | |
… | |
11 | }); |
11 | }); |
12 | } |
12 | } |
13 | |
13 | |
14 | sub on_start { |
14 | sub on_start { |
15 | my ($self) = @_; |
15 | my ($self) = @_; |
|
|
16 | |
|
|
17 | $self->{browser} = urxvt::untaint $self->x_resource ("urlLauncher") || "x-www-browser"; |
16 | |
18 | |
17 | $self->grab_button (3, urxvt::ControlMask); |
19 | $self->grab_button (3, urxvt::ControlMask); |
18 | } |
20 | } |
19 | |
21 | |
20 | sub on_button_press { |
22 | sub on_button_press { |
… | |
… | |
53 | |
55 | |
54 | for ($text) { |
56 | for ($text) { |
55 | $add_button->("rot13" => sub { y/A-Za-z/N-ZA-Mn-za-m/ }); |
57 | $add_button->("rot13" => sub { y/A-Za-z/N-ZA-Mn-za-m/ }); |
56 | |
58 | |
57 | urxvt::safe |
59 | urxvt::safe |
58 | and $add_button->("eval perl expression" => sub { $_ = eval urxvt::untaint $_ }); |
60 | and $add_button->("eval perl expression" => sub { no warnings; $_ = eval urxvt::untaint $_ }); |
59 | |
61 | |
60 | /^(\S+):(\d+):?$/ |
62 | /^(\S+):(\d+):?$/ |
61 | and $add_button->("vi-commands to load '$1'" => sub { s/^(\S+):(\d+):?$/\x1b:e $1\x0d:$2\x0d/ }); |
63 | and $add_button->("vi-commands to load '$1'" => sub { s/^(\S+):(\d+):?$/\x1b:e $1\x0d:$2\x0d/ }); |
62 | |
64 | |
63 | /%[0-9a-fA-F]{2}/ && !/%[^0-9a-fA-F]/ && !/%.[^0-9a-fA-F]/ |
65 | /%[0-9a-fA-F]{2}/ && !/%[^0-9a-fA-F]/ && !/%.[^0-9a-fA-F]/ |
… | |
… | |
65 | |
67 | |
66 | /[\\"'\ \t|&;<>()]/ |
68 | /[\\"'\ \t|&;<>()]/ |
67 | and $add_button->("shell quote" => sub { $_ = "\Q$_" }); |
69 | and $add_button->("shell quote" => sub { $_ = "\Q$_" }); |
68 | |
70 | |
69 | /^(http|ftp|telnet|irc|news):\// |
71 | /^(http|ftp|telnet|irc|news):\// |
70 | and $add_button->("run x-www-browser" => sub { system "x-www-browser \Q$_\E &" }); |
72 | and $add_button->("run $self->{browser}" => sub { system "$self->{browser} \Q$_\E &" }); |
71 | } |
73 | } |
72 | |
74 | |
73 | $popup->show; |
75 | $popup->show; |
74 | |
76 | |
75 | return 1; |
77 | return 1; |