… | |
… | |
18 | my $idx = 0; |
18 | my $idx = 0; |
19 | |
19 | |
20 | for my $tab (@{ $self->{tabs} }) { |
20 | for my $tab (@{ $self->{tabs} }) { |
21 | $idx++; |
21 | $idx++; |
22 | |
22 | |
|
|
23 | my $act = $tab->{activity} && $tab != $self->{cur} |
|
|
24 | ? "*" : " "; |
|
|
25 | |
23 | my $txt = " $idx "; |
26 | my $txt = "$act$idx$act"; |
24 | my $len = length $txt; |
27 | my $len = length $txt; |
25 | |
28 | |
26 | substr $text, $ofs, $len + 1, "$txt|"; |
29 | substr $text, $ofs, $len + 1, "$txt|"; |
27 | @$rend[$ofs .. $ofs + $len - 1] = (urxvt::OVERLAY_RSTYLE) x $len |
30 | @$rend[$ofs .. $ofs + $len - 1] = (urxvt::OVERLAY_RSTYLE) x $len |
28 | if $tab == $self->{cur}; |
31 | if $tab == $self->{cur}; |
… | |
… | |
96 | |
99 | |
97 | sub make_current { |
100 | sub make_current { |
98 | my ($self, $tab) = @_; |
101 | my ($self, $tab) = @_; |
99 | |
102 | |
100 | if (my $cur = $self->{cur}) { |
103 | if (my $cur = $self->{cur}) { |
|
|
104 | delete $cur->{activity}; |
101 | $cur->XUnmapWindow ($cur->parent) if $cur->mapped; |
105 | $cur->XUnmapWindow ($cur->parent) if $cur->mapped; |
102 | $cur->focus_out; |
106 | $cur->focus_out; |
103 | } |
107 | } |
104 | |
108 | |
105 | $self->{cur} = $tab; |
109 | $self->{cur} = $tab; |
106 | |
110 | |
107 | $self->configure; |
111 | $self->configure; |
108 | $tab->focus_in; |
112 | $tab->focus_in; |
109 | $tab->XMapWindow ($tab->parent); |
113 | $tab->XMapWindow ($tab->parent); |
110 | $self->refresh; |
114 | $self->refresh; |
|
|
115 | delete $tab->{activity}; |
111 | |
116 | |
112 | () |
117 | () |
113 | } |
118 | } |
114 | |
119 | |
115 | sub on_button_press { |
120 | sub on_button_press { |
… | |
… | |
227 | } |
232 | } |
228 | |
233 | |
229 | () |
234 | () |
230 | } |
235 | } |
231 | |
236 | |
|
|
237 | sub tab_activity { |
|
|
238 | my ($self, $tab) = @_; |
|
|
239 | |
|
|
240 | $self->refresh; |
|
|
241 | } |
|
|
242 | |
232 | package urxvt::ext::tabbed::tab; |
243 | package urxvt::ext::tabbed::tab; |
233 | |
244 | |
234 | # helper extension implementing the subwindows of a tabbed terminal. |
245 | # helper extension implementing the subwindows of a tabbed terminal. |
235 | # simply proxies all interesting calls back to the tabbed class. |
246 | # simply proxies all interesting calls back to the tabbed class. |
236 | |
247 | |
… | |
… | |
245 | }; |
256 | }; |
246 | die if $@; |
257 | die if $@; |
247 | } |
258 | } |
248 | } |
259 | } |
249 | |
260 | |
|
|
261 | sub on_add_lines { |
|
|
262 | $_[0]->{activity}++ |
|
|
263 | or $_[0]{term}{parent}->tab_activity ($_[0]); |
|
|
264 | () |
|
|
265 | } |
250 | |
266 | |
251 | |
267 | |