Problem with executing keysym events
Trey Blancher
trey at blancher.net
Fri Jun 3 06:49:39 CEST 2011
I have two issues. One, the clipboard copy event is triggered, but it
appears the code is not executed. Also, the new_tab event is
triggered, but the standard urxvt::tabbed new_tab sub doesn't appear
to be executed
I have the following in .Xdefaults:
URxvt.perl-lib: /home/trey/urxvt
!... other stuff omitted
URxvt.keysym.Shift-Control-C: perl:clipboard:copy
URxvt.keysym.Shift-Control-V: perl:clipboard:paste
URxvt.keysym.Shift-Control-T: perl:tabbed:new_tab
And I have the following ~/urxvt/clipboard
#! perl
sub on_sel_grab {
my $query = $_[0]->selection;
open (my $pipe,'| /usr/bin/xclip -in -selection primary') or die;
print $pipe $query;
close $pipe;
}
# the following is my effort to get clipboard copy working.
sub copy {
urxvt::warn "DEBUG: Entering clipbooard:copy sub..." ;
my $query = $_[0]->selection;
#open (my $pipe,'| /usr/bin/xclip -in -selection clipboard') or die;
#open (my $pipe,'| /usr/bin/xsel --input --clipboard') or die;
urxvt::warn "DEBUG: Calling xsel..." ;
system("echo $query | /usr/bin/xsel --input --clipboard") ;
#urxvt::warn "DEBUG: \$trash = $trash" ;
#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;
}
}
I have launched urxvt with "URXVT_PERL_VERBOSITY=11 urxvt", and all
the perl modules are loading with no problems as far as I can tell.
During troubleshooting, I'd break the clipboard module, and none of
the modules would load. With all the modules loaded properly I get
the following events when the keysyms fail:
urxvt: USER_COMMAND (urxvt::term=HASH(0x294d3c0), clipboard:copy)
urxvt: USER_COMMAND returning <>
...
urxvt: USER_COMMAND (urxvt::term=HASH(0x294d3c0), tabbed:new_tab)
urxvt: USER_COMMAND returning <>
None of the debug code I entered show up, which leads me to believe
it's not getting executed. What's so maddening about this, is when I
copy something to the clipboard in another window, and hit
CTRL-SHIFT-V in urxvt, it pastes as expected, and I see the following
event in the debug:
urxvt: USER_COMMAND (urxvt::term=HASH(0x294d3c0), clipboard:paste)
urxvt: USER_COMMAND returning <>
As far as I can tell, there's no difference, it's just not executing
the clipboard:copy or tabbed:new_tab code, and I can't figure out why.
I'm coming from gnome-terminal, and I see a lot of promise with
urxvt, but not having a point-and-click GUI makes it rather opaque.
Not that I'm suggesting it should have a point and click GUI, it just
takes longer to come up to speed.
More information about the rxvt-unicode
mailing list