Custom perl to paste X CLIPBOARD stopped working
Chip Camden
sterling at camdensoftware.com
Sun May 1 18:21:45 CEST 2011
Quoth rxvt-unicode at catcons.co.uk on Sunday, 01 May 2011:
> Hello :-)
>
> A custom perl script for hotkey pasting X CLIPBOARD into urxvt stopped
> working. I am not aware of any system change that coincided with the
> breakage, despite keeping logs and using paste in urxvt very frequently.
>
> ~/.Xresources includes:
>
> URxvt.keysym.Mod4-v: perl:clipboard:paste
> URxvt.perl-ext-common: default,matcher,clipboard
>
> /usr/lib64/urxvt/perl/clipboard is:
>
> #! perl
> sub on_sel_grab {
> my $query = $_[0]->selection;
> open (my $pipe,'| /usr/bin/xclip -in -selection clipboard') or die;
> print $pipe $query;
> close $pipe;
> }
> sub paste {
> my ($self) = @_;
> my $content = `/usr/bin/xclip -loop 1 -out -selection clipboard` ;
> $self->tt_write ($content);
> }
> sub on_user_command {
> my ($self, $cmd) = @_;
> if ($cmd eq "clipboard:paste") {
> $self->paste;
> }
> }
>
> The xclip command works at the command prompt. The script's file size and
> permissions are the same as when it was installed. I added logging to the
> script, for example in the paste sub:
>
> open(my $logfh, '>>/tmp/urxvt_paste.log') ;
> print $logfh "paste: running\n";
>
> No logs appeared. I ran urxvt by:
>
> URXVT_PERL_VERBOSITY=11 urxvt -pe clipboard &
>
> The trace included:
>
> urxvt: loading extension '/usr/lib64/urxvt/perl/clipboard' into package
> 'urxvt::ext::clipboard'
> [used Super+V]
> urxvt: USER_COMMAND (urxvt::term=HASH(0x8bfef8), clipboard:paste )
> urxvt: USER_COMMAND returning <>
>
> It seemed the custom perl script's sub was being called but was not
> effective. urxvt 9.10 was removed and re-installed. Same.
>
> A "hello world" perl script worked.
>
> Experimenting, I changed the shebang line in /usr/lib64/urxvt/perl/clipboard
> to:
>
> #! /usr/bin/perl
>
> and tested again. The logs appeared for subs on_user_command and
> on_sel_grab but the on_user_command log did not show the "if ($cmd eq
> "clipboard:paste")" test passed.
>
> What can I try now?
>
> Best
>
> Charles
>
>
Grasping at straws here. Maybe try renaming the "paste" function? Or
try adding something to the paste function to let you know it got there?
I often just do a print and then by starting urxvt from a shell prompt
you can see the print output in the parent shell.
--
.O. | Sterling (Chip) Camden | http://camdensoftware.com
..O | sterling at camdensoftware.com | http://chipsquips.com
OOO | 2048R/D6DBAF91 | http://chipstips.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://lists.schmorp.de/pipermail/rxvt-unicode/attachments/20110501/411b1fbf/attachment.sig>
More information about the rxvt-unicode
mailing list