summaryrefslogtreecommitdiff
path: root/lib/App/Raps2/UI.pm
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2011-07-21 16:53:18 +0200
committerDaniel Friesel <derf@finalrewind.org>2011-07-21 16:53:18 +0200
commitc22143897b300085d7c8ef37e8fe4850a0c2aca2 (patch)
tree0539b1fff555f396aeabb9af4228ce1d6f4b3033 /lib/App/Raps2/UI.pm
parent7e948f4248953e135ba9824e15801b313f69c9da (diff)
Make xclip command configurable (->chrome support)
Diffstat (limited to 'lib/App/Raps2/UI.pm')
-rw-r--r--lib/App/Raps2/UI.pm13
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/App/Raps2/UI.pm b/lib/App/Raps2/UI.pm
index 4914b71..ca86a59 100644
--- a/lib/App/Raps2/UI.pm
+++ b/lib/App/Raps2/UI.pm
@@ -89,15 +89,17 @@ sub read_pw {
}
sub to_clipboard {
- my ( $self, $str ) = @_;
+ my ( $self, $str, $cmd ) = @_;
+
+ $cmd //= 'xclip -l 1';
- open( my $clipboard, q{|-}, 'xclip -l 1' )
+ open( my $clipboard, q{|-}, $cmd )
or return;
print $clipboard $str;
close($clipboard)
- or cluck("Failed to close pipe to xclip: $!");
+ or cluck("Failed to close pipe to ${cmd}: ${!}");
return 1;
}
@@ -172,9 +174,10 @@ Prompt the user for a password. I<message> is displayed, the user's input is
noch echoed. If I<verify> is set, the user has to enter the same input twice,
otherwise B<read_pw> dies. Returns the input.
-=item $ui->to_clipboard(I<$string>)
+=item $ui->to_clipboard(I<$string>, [I<command>])
-Place I<string> in the primary X Clipboard (by calling the B<xclip> program)
+Call I<command> to place I<string> in the primary X Clipboard. I<command>
+defaults to C<< xclip -l 1 >>.
Returns true upon success, undef if the operation failed. Use $! to get the
error message.