Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Highlight tab if it used by the root #32

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions tabbedex
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,10 @@ sub tab_activity_mark ($$) {
'*';
}

sub tab_is_root {
my ($self, $tab) = @_;
$tab->{term}->XGetWindowProperty($tab->{term}->parent, $self->{tab_title}) =~ /^root@/i;
}

sub refresh {
my ($self) = @_;
Expand Down Expand Up @@ -154,8 +158,13 @@ sub refresh {
my $len = length $txt;

substr $text, $ofs, $len + 1, "$txt|";
@$rend[$ofs .. $ofs + $len - 1] = ($self->{rs_tab}) x $len
if $tab == $self->{cur};

if ($self->tab_is_root($tab)) {
@$rend[$ofs .. $ofs + $len - 1] = ($tab != $self->{cur} ? $self->{rs_root} : $self->{rs_roots}) x $len;
} else {
@$rend[$ofs .. $ofs + $len - 1] = ($self->{rs_tab}) x $len
if ($tab == $self->{cur});
}

push @ofs, [ $ofs, $ofs + $len, $idx ];
++$idx;
Expand Down Expand Up @@ -384,6 +393,8 @@ sub on_init {
$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);
$self->{rs_title} = urxvt::SET_COLOR (urxvt::DEFAULT_RSTYLE, $titfg + 2, $titbg + 2);
$self->{rs_root} = urxvt::SET_COLOR (urxvt::DEFAULT_RSTYLE, $tabfg + 2, 3);
$self->{rs_roots} = urxvt::SET_COLOR (urxvt::DEFAULT_RSTYLE, $tabbg + 2, 3);


my $timeouts = $self->my_resource ("tabbar-timeouts");
Expand Down