1 | #! perl |
1 | #! perl |
2 | |
2 | |
3 | #:META:X_RESOURCE:%.cmd:string:the command to run create a new pastebin |
3 | #:META:RESOURCE:%.cmd:string:the command to run create a new pastebin |
4 | #:META:X_RESOURCE:%.url:string:the url template for new pastebins |
4 | #:META:RESOURCE:%.url:string:the url template for new pastebins |
5 | |
5 | |
6 | =head1 NAME |
6 | =head1 NAME |
7 | |
7 | |
8 | selection-pastebin - automatic pastebin upload |
8 | selection-pastebin - automatic pastebin upload |
|
|
9 | |
|
|
10 | =head1 EXAMPLES |
|
|
11 | |
|
|
12 | URxvt.keysym.C-M-e: selection-pastebin:remote-pastebin |
9 | |
13 | |
10 | =head1 DESCRIPTION |
14 | =head1 DESCRIPTION |
11 | |
15 | |
12 | This is a little rarely useful extension that uploads the selection as |
16 | This is a little rarely useful extension that uploads the selection as |
13 | textfile to a remote site (or does other things). (The implementation is |
17 | textfile to a remote site (or does other things). (The implementation is |
14 | not currently secure for use in a multiuser environment as it writes to |
18 | not currently secure for use in a multiuser environment as it writes to |
15 | F</tmp> directly.). |
19 | F</tmp> directly.). |
16 | |
20 | |
17 | It listens to the C<selection-pastebin:remote-pastebin> keyboard command, |
21 | It listens to the C<selection-pastebin:remote-pastebin> action, which, |
18 | i.e. |
22 | when activated, runs a command with C<%> replaced by the name of the |
19 | |
|
|
20 | URxvt.keysym.C-M-e: perl:selection-pastebin:remote-pastebin |
|
|
21 | |
|
|
22 | Pressing this combination runs a command with C<%> replaced by the name of |
|
|
23 | the textfile. This command can be set via a resource: |
23 | textfile. This command can be set via a resource: |
24 | |
24 | |
25 | URxvt.selection-pastebin.cmd: rsync -apP % ruth:/var/www/www.ta-sa.org/files/txt/. |
25 | URxvt.selection-pastebin.cmd: rsync -apP % ruth:/var/www/www.ta-sa.org/files/txt/. |
26 | |
26 | |
27 | And the default is likely not useful to anybody but the few people around |
27 | And the default is likely not useful to anybody but the few people around |
28 | here :) |
28 | here :) |
… | |
… | |
113 | }; |
113 | }; |
114 | |
114 | |
115 | () |
115 | () |
116 | } |
116 | } |
117 | |
117 | |
118 | sub on_user_command { |
118 | sub on_action { |
119 | my ($self, $cmd) = @_; |
119 | my ($self, $action) = @_; |
120 | |
120 | |
121 | if ($cmd eq "selection-pastebin:remote-pastebin") { |
121 | $action eq "remote-pastebin" |
122 | $self->upload_paste; |
122 | and $self->upload_paste; |
123 | } |
|
|
124 | |
123 | |
125 | () |
124 | () |
126 | } |
125 | } |
127 | |
126 | |