On Sun, 1 May 2011, Chip Camden wrote:
Quoth rxvt-unicode 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
The error might be in the matcher plugin. If any plugin fails to load
properly, they're all borked.
/usr/lib64/urxvt/perl/clipboard is:
As with most programs, you should put your own customizations into your
own director(y|ies). If you add:
URxvt*perl-lib: /home/username/urxvt
You can put this in /home/username/urxvt/clipboard.
This prevents it from being messed-with or accidentally removed when
upgrading rxvt-unicode via package management.
#! 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;
}
}
This script works fine for me under 9.07 and 9.10, w/ Perl v.5.12.1.
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.
The shebang line shouldn't matter at all. The script doesn't get called
from any context where that line is interpreted. To the Perl
interpreter, it's just a comment.
What can I try now?
Try disabling the matcher plugin or not enabling the default extensions.
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.
I second the "start from a shell prompt" suggestion. It's pretty easy
to detect the condition I mentioned above (when another plugin fails to
load properly).
--
Best,
Ben
_______________________________________________
rxvt-unicode mailing list
[email protected]
http://lists.schmorp.de/cgi-bin/mailman/listinfo/rxvt-unicode