1
0
mirror of https://github.com/gryf/tabbedalt.git synced 2025-12-17 11:30:31 +01:00

Added ability to disable tab activity indicator.

This commit is contained in:
2024-06-10 10:42:27 +02:00
parent 7e76d39402
commit a9eb5cee5d
2 changed files with 17 additions and 8 deletions

View File

@@ -121,6 +121,10 @@ You can change those values but bear in mind, that first group should have
timeout in seconds set higher, than middle one. You can also change symbols for timeout in seconds set higher, than middle one. You can also change symbols for
those groups. those groups.
Tab activity can be disabled by setting::
URxvt.tabbedalt.disable-activity: true
Flickering Flickering
~~~~~~~~~~ ~~~~~~~~~~

View File

@@ -155,6 +155,9 @@
# #
# 2023-10-28 16:30:32 # 2023-10-28 16:30:32
# - Added overlay based dialog to confirm closing urxvt window # - Added overlay based dialog to confirm closing urxvt window
#
# 2024-06-10 10:34:47
# - Added option for disabling activity marks and colors
use Scalar::Util; use Scalar::Util;
@@ -228,6 +231,7 @@ package urxvt::ext::tabbedalt::main;
sub tab_activity_mark ($$) { sub tab_activity_mark ($$) {
my ($self, $tab) = @_; my ($self, $tab) = @_;
return ' ' unless defined $tab->{lastActivity}; return ' ' unless defined $tab->{lastActivity};
return ' ' if $self->{disable_activity};
return ' ' if $tab == $self->{cur}; return ' ' if $tab == $self->{cur};
if (defined $self->{timeouts}) { if (defined $self->{timeouts}) {
my $diff = int urxvt::NOW - $tab->{lastActivity}; my $diff = int urxvt::NOW - $tab->{lastActivity};
@@ -306,6 +310,7 @@ sub refresh {
if ($tab == $self->{cur}) { if ($tab == $self->{cur}) {
@$rend[$ofs .. $ofs + $len - 1] = ($self->{rs_tab}) x $len; @$rend[$ofs .. $ofs + $len - 1] = ($self->{rs_tab}) x $len;
} else { } else {
if (!$self->{disable_activity}) {
if ($act eq "*") { if ($act eq "*") {
@$rend[$ofs .. $ofs + $len - 1] = ($self->{rs_tab_act}) x $len; @$rend[$ofs .. $ofs + $len - 1] = ($self->{rs_tab_act}) x $len;
} elsif ($act eq $self->{timeouts}[0][1]) { } elsif ($act eq $self->{timeouts}[0][1]) {
@@ -314,6 +319,7 @@ sub refresh {
@$rend[$ofs .. $ofs + $len - 1] = ($self->{rs_tab_acs}) x $len; @$rend[$ofs .. $ofs + $len - 1] = ($self->{rs_tab_acs}) x $len;
} }
} }
}
# sub with make current will activate events with mouse buttons # sub with make current will activate events with mouse buttons
push @ofs, [ $ofs, $ofs + $len, sub { $_[0]->make_current ($tab) } ]; push @ofs, [ $ofs, $ofs + $len, sub { $_[0]->make_current ($tab) } ];
@@ -566,6 +572,7 @@ sub init {
$self->{stop_flickering} = $self->x_resource_boolean('stop-flickering'); $self->{stop_flickering} = $self->x_resource_boolean('stop-flickering');
$self->{confirm_quit} = $self->x_resource_boolean('confirm-quit'); $self->{confirm_quit} = $self->x_resource_boolean('confirm-quit');
$self->{confirm_program} = $self->x_resource('confirm-program'); $self->{confirm_program} = $self->x_resource('confirm-program');
$self->{disable_activity} = $self->x_resource_boolean('disable-activity');
my $timeouts = $self->x_resource ("tabbar-timeouts"); my $timeouts = $self->x_resource ("tabbar-timeouts");
$timeouts = '16:.:8:::4:+' unless defined $timeouts; $timeouts = '16:.:8:::4:+' unless defined $timeouts;
@@ -691,10 +698,8 @@ _on wm_delete_window => sub {
my $marginc = 0; my $marginc = 0;
$qst = "$qst (y/n)"; $qst = "$qst (y/n)";
if ((length $msg) > (length $qst)) { if ((length $msg) > (length $qst)) {
print("length $msg > length $qst\n");
$marginc = int(($self->ncol - length $msg)/2); $marginc = int(($self->ncol - length $msg)/2);
} elsif ((length $msg) <= (length $qst)) { } elsif ((length $msg) <= (length $qst)) {
print("length $msg <= length $qst\n");
$marginc = int(($self->ncol - length $qst)/2); $marginc = int(($self->ncol - length $qst)/2);
} }
my $marginr = int(($self->nrow - 4)/2); my $marginr = int(($self->nrow - 4)/2);