diff --git a/url-select b/url-select old mode 100644 new mode 100755 index 7b07b20..120d83d --- a/url-select +++ b/url-select @@ -24,6 +24,11 @@ # URxvt.urlLauncher: Browser/command to open selected URL with # URxvt.underlineURLs: If set to true, all URLs get underlined # URvxt.urlButton: Mouse button to click-open URLs (default: 2) +# URxvt.urlCopier: Command to copy the URL to the clipboard (optional) +# Recommended (and tested) - the following script: +# #!/bin/sh +# echo -n "$*" | xclip -in + use strict; @@ -37,6 +42,12 @@ sub on_start { my ($self) = @_; # read resource settings + if ($self->x_resource('urlCopier')) { + @{$self->{copier}} = split /\s+/, $self->x_resource('urlCopier'); + } else { + @{$self->{copier}} = (); + } + if ($self->x_resource('urlLauncher')) { @{$self->{browser}} = split /\s+/, $self->x_resource('urlLauncher'); } else { @@ -176,6 +187,7 @@ sub select_next { # another url on current line $self->{n} += $dir; hilight($self); + $self->exec_async(@{$self->{copier}}, $self->{found}->[$self->{n}]->[4]) if $self->{copier}; return; } @@ -199,6 +211,7 @@ sub select_next { $self->{row} = $row; $self->{n} = $dir < 0 ? $#{$self->{found}} : 0; hilight($self); + $self->exec_async(@{$self->{copier}}, $self->{found}->[$self->{n}]->[4]) if $self->{copier}; return; } }