1 | #! perl |
1 | #! perl |
2 | |
2 | |
3 | #:META:X_RESOURCE:tabbar-fg:tab bar foreground colour |
3 | #:META:RESOURCE:tabbar-fg:colour:tab bar foreground colour |
4 | #:META:X_RESOURCE:tabbar-bg:tab bar background colour |
4 | #:META:RESOURCE:tabbar-bg:colour:tab bar background colour |
5 | #:META:X_RESOURCE:tab-fg:tab foreground colour |
5 | #:META:RESOURCE:tab-fg:colour:tab foreground colour |
6 | #:META:X_RESOURCE:tab-bg:tab background colour |
6 | #:META:RESOURCE:tab-bg:colour:tab background colour |
|
|
7 | |
|
|
8 | =head1 NAME |
|
|
9 | |
|
|
10 | tabbed - tabbed interface to urxvt |
|
|
11 | |
|
|
12 | =head1 DESCRIPTION |
|
|
13 | |
|
|
14 | This transforms the terminal into a tabbar with additional terminals, that |
|
|
15 | is, it implements what is commonly referred to as "tabbed terminal". The topmost line |
|
|
16 | displays a "[NEW]" button, which, when clicked, will add a new tab, followed by one |
|
|
17 | button per tab. |
|
|
18 | |
|
|
19 | Clicking a button will activate that tab. Pressing B<Shift-Left> and |
|
|
20 | B<Shift-Right> will switch to the tab left or right of the current one, |
|
|
21 | while B<Shift-Down> creates a new tab. Pressing B<Ctrl-Left> and |
|
|
22 | B<Ctrl-Right> will renumber the current tab by moving it to the left or |
|
|
23 | to the right. |
|
|
24 | |
|
|
25 | The tabbar itself can be configured similarly to a normal terminal, but |
|
|
26 | with a resource class of C<URxvt.tabbed>. In addition, it supports the |
|
|
27 | following four resources (shown with defaults): |
|
|
28 | |
|
|
29 | URxvt.tabbed.tabbar-fg: <colour-index, default 3> |
|
|
30 | URxvt.tabbed.tabbar-bg: <colour-index, default 0> |
|
|
31 | URxvt.tabbed.tab-fg: <colour-index, default 0> |
|
|
32 | URxvt.tabbed.tab-bg: <colour-index, default 1> |
|
|
33 | |
|
|
34 | See I<COLOR AND GRAPHICS> in the urxvt(1) manpage for valid |
|
|
35 | indices. |
|
|
36 | |
|
|
37 | =cut |
7 | |
38 | |
8 | sub refresh { |
39 | sub refresh { |
9 | my ($self) = @_; |
40 | my ($self) = @_; |
10 | |
41 | |
11 | my $ncol = $self->ncol; |
42 | my $ncol = $self->ncol; |
… | |
… | |
183 | |
214 | |
184 | sub on_key_press { |
215 | sub on_key_press { |
185 | my ($self, $event) = @_; |
216 | my ($self, $event) = @_; |
186 | |
217 | |
187 | $self->{cur}->key_press ($event->{state}, $event->{keycode}, $event->{time}); |
218 | $self->{cur}->key_press ($event->{state}, $event->{keycode}, $event->{time}); |
|
|
219 | $self->{cur}->refresh_check; |
188 | |
220 | |
189 | 1 |
221 | 1 |
190 | } |
222 | } |
191 | |
223 | |
192 | sub on_key_release { |
224 | sub on_key_release { |
193 | my ($self, $event) = @_; |
225 | my ($self, $event) = @_; |
194 | |
226 | |
195 | $self->{cur}->key_release ($event->{state}, $event->{keycode}, $event->{time}); |
227 | $self->{cur}->key_release ($event->{state}, $event->{keycode}, $event->{time}); |
|
|
228 | $self->{cur}->refresh_check; |
196 | |
229 | |
197 | 1 |
230 | 1 |
198 | } |
231 | } |
199 | |
232 | |
200 | sub on_button_press { |
233 | sub on_button_press { |
… | |
… | |
369 | |
402 | |
370 | # helper extension implementing the subwindows of a tabbed terminal. |
403 | # helper extension implementing the subwindows of a tabbed terminal. |
371 | # simply proxies all interesting calls back to the tabbed class. |
404 | # simply proxies all interesting calls back to the tabbed class. |
372 | |
405 | |
373 | { |
406 | { |
374 | for my $hook qw(start destroy key_press property_notify) { |
407 | for my $hook (qw(start destroy key_press property_notify)) { |
375 | eval qq{ |
408 | eval qq{ |
376 | sub on_$hook { |
409 | sub on_$hook { |
377 | my \$parent = \$_[0]{term}{parent} |
410 | my \$parent = \$_[0]{term}{parent} |
378 | or return; |
411 | or return; |
379 | \$parent->tab_$hook (\@_) |
412 | \$parent->tab_$hook (\@_) |