Custom perl to paste X CLIPBOARD stopped working
rxvt-unicode at catcons.co.uk
rxvt-unicode at catcons.co.uk
Sun May 1 06:58:30 CEST 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
More information about the rxvt-unicode
mailing list