You are not logged in.

#1 2012-03-06 15:56:25

Mr. Alex
Member
Registered: 2010-08-26
Posts: 623

urxvt - set another hotkeys for tabs

Hello.

How do I change hotkeys for tabbed urxvt? For example Shift+Right to Ctrl+Right to switch to next tab? Shift conflicts with editing in mcedit.

Last edited by Mr. Alex (2012-03-20 12:31:43)

Offline

#2 2012-03-07 23:02:11

wolfcore
Member
From: California
Registered: 2012-03-06
Posts: 137

Re: urxvt - set another hotkeys for tabs

You might have to tweak the corresponding perl extension.

Offline

#3 2012-03-08 10:08:47

Mr. Alex
Member
Registered: 2010-08-26
Posts: 623

Re: urxvt - set another hotkeys for tabs

This one? > /usr/lib/urxvt/perl/tabbed
I don't code Perl so could you tell which thing to change? Simple search for "shift" in file doesn't give me a keybinding.

Offline

#4 2012-03-09 22:08:45

wolfcore
Member
From: California
Registered: 2012-03-06
Posts: 137

Re: urxvt - set another hotkeys for tabs

Mr. Alex wrote:

This one? > /usr/lib/urxvt/perl/tabbed
I don't code Perl so could you tell which thing to change? Simple search for "shift" in file doesn't give me a keybinding.

Sorry, I don't know Perl either.

It shouldn't be that hard though.

Offline

#5 2012-03-13 02:56:36

Thanoulis
Member
From: Lamia, Greece
Registered: 2009-05-03
Posts: 33
Website

Re: urxvt - set another hotkeys for tabs

It's quite simple.
Just edit /usr/lib/urxvt/perl/tabbed and go to line 315. It reads:

if ($event->{state} & urxvt::ShiftMask) {

All you have to do, is replace "Shift", with "Control". The line must look like this:

if ($event->{state} & urxvt::ControlMask) {

I already checked it, and it works.
Keep in mind though, that it's a system file, and maybe it will be overwritten after an update.
But you can copy it under another name and execute it like this:

urxvt -pe your-new-fancy-script

-- Beware of he who would deny you access to information, for in his heart he dreams himself your master.

Offline

#6 2012-03-19 10:33:55

Mr. Alex
Member
Registered: 2010-08-26
Posts: 623

Re: urxvt - set another hotkeys for tabs

Thanoulis, thanks. Where do I find Ctrl+D combo to make it Ctrl+W?

Offline

#7 2012-03-20 12:31:35

Mr. Alex
Member
Registered: 2010-08-26
Posts: 623

Re: urxvt - set another hotkeys for tabs

It seems that the key may be here:

sub tab_destroy {
   my ($self, $tab) = @_;

   $self->{tabs} = [ grep $_ != $tab, @{ $self->{tabs} } ];

   if (@{ $self->{tabs} }) {
      if ($self->{cur} == $tab) {
         delete $self->{cur};
         $self->make_current ($self->{tabs}[-1]);
      } else {
         $self->refresh;
      }
   } else {
      # delay destruction a tiny bit
      $self->{destroy} = urxvt::iw->new->start->cb (sub { $self->destroy });
   }

   ()
}

but I can't parse it...

Offline

#8 2012-03-20 17:59:54

wolfcore
Member
From: California
Registered: 2012-03-06
Posts: 137

Re: urxvt - set another hotkeys for tabs

Mr. Alex wrote:

Thanoulis, thanks. Where do I find Ctrl+D combo to make it Ctrl+W?

I don't know if you can change that...C-d sends End-Of-File to the current process. It might be that rvxt-unicode is set to terminate when it receives EOF.

Offline

#9 2012-07-12 03:28:59

cvhacker
Member
Registered: 2012-07-12
Posts: 2
Website

Re: urxvt - set another hotkeys for tabs

Hi, I have write one using .Xresources to configure the shortkeys. Hope you can find it useful. Here is the link

http://kuantkid.github.com/urxvt-utils/

One thing, if you want to use the like Ctrl+W , you have to make the CtrlKey to be ctrl rather than Shift as Shift+W will not triger the ($event->{state} & urxvt::ShiftMask) but only response as a Capital W.

This is not tested intensively and you may find many bugs :-) . If you have any problem please do leave me a message either in github or in this thread. I will try to correct it asap.

Last edited by cvhacker (2012-08-28 06:47:20)

Offline

Board footer

Powered by FluxBB