Hi,

this is a small patch on perl/tabbed. it makes tabbed extension support 
directly tab accessing by pressing ctrl + n (where n is from 0 to 9). also, i 
applied some color changs which makes the tab bar look more comfortable as i 
thought. 

since i'm new to rxvt-unicode, if it is a stupid patch just ignore it.

thanks


      
diff -rupN orig/tabbed new/tabbed
--- orig/tabbed	2009-04-20 10:23:35.000000000 +0800
+++ new/tabbed	2009-04-20 10:29:38.000000000 +0800
@@ -10,8 +10,8 @@ sub refresh {
 
    my @ofs;
 
-   substr $text, 0, 7, "[NEW] |";
-   @$rend[0 .. 5] = ($self->{rs_tab}) x 6;
+   substr $text, 0, 7, "  NEW  ";
+   @$rend[0 .. 5] = ($self->{rs_tabbar}) x 6;
    push @ofs, [0, 6, sub { $_[0]->new_tab }];
 
    my $ofs = 7;
@@ -26,7 +26,7 @@ sub refresh {
       my $txt = "$act$idx$act";
       my $len = length $txt;
 
-      substr $text, $ofs, $len + 1, "$txt|";
+      substr $text, $ofs, $len + 1, "$txt ";
       @$rend[$ofs .. $ofs + $len - 1] = ($self->{rs_tab}) x $len
          if $tab == $self->{cur};
 
@@ -224,10 +224,10 @@ sub on_init {
    my $tabfg = $self->x_resource ("tab-fg");
    my $tabbg = $self->x_resource ("tab-bg");
 
-   defined $fg    or $fg    = 3;
-   defined $bg    or $bg    = 0;
-   defined $tabfg or $tabfg = 0;
-   defined $tabbg or $tabbg = 1;
+   defined $fg    or $fg    = 0;
+   defined $bg    or $bg    = 7;
+   defined $tabfg or $tabfg = 12;
+   defined $tabbg or $tabbg = 0;
 
    $self->{rs_tabbar} = urxvt::SET_COLOR (urxvt::DEFAULT_RSTYLE, $fg    + 2, $bg    + 2);
    $self->{rs_tab}    = urxvt::SET_COLOR (urxvt::DEFAULT_RSTYLE, $tabfg + 2, $tabbg + 2);
@@ -333,7 +333,12 @@ sub tab_key_press {
          $self->make_current ($self->{tabs}[$idx2]);
 
          return 1;
-      }
+      } elsif ($keysym > 48 && $keysym < 58) {
+         my ($idx) = $keysym - 49;
+         $self->make_current ($self->{tabs}[$idx]) if $self->{tabs}[$idx] != $tab and $idx < @{ $self->{tabs}};
+
+         return 1;
+	  }
    }
 
    ()
_______________________________________________
rxvt-unicode mailing list
[email protected]
http://lists.schmorp.de/cgi-bin/mailman/listinfo/rxvt-unicode

Reply via email to