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

Added autohide feature.

This commit is contained in:
2022-02-22 16:50:26 +01:00
parent 305dc95b3e
commit 7d10c9f4f5
2 changed files with 37 additions and 5 deletions

View File

@@ -29,6 +29,7 @@ Features
some text and press ``RETURN`` for accept or ``ESC`` for cancel.
* Added ability to configure own shortcuts using standard ``keysym`` urxvt
option. See below for examples.
* Autohide tab when there is only one tab at the moment.
Installation
------------
@@ -126,6 +127,18 @@ space::
URxvt.tabbedalt.tab-numbers: false
Autohide
~~~~~~~~
To hide tab bar, when there is a single tab, the following resource need to be
set to true::
URxvt.tabbedalt.autohide: true
By default tab bar would be visible even with only one tab. Note, that it will
be visible regardless of this option, when ``new-button`` is set. So to make
that option work, you'll need to also disable new-button.
Actions
~~~~~~~
@@ -226,9 +239,9 @@ Resource values are colon separated values, which are in order:
Renaming tabs
-------------
On runtime, tabs can be renamed using (by default) ``Shift+Up`` - now you can type name for
the tab. ``Return`` accept change, ``ESC`` cancels it. This feature was taken
from `stepb`_ tabbedx repository.
On runtime, tabs can be renamed using (by default) ``Shift+Up`` - now you can
type name for the tab. ``Return`` accept change, ``ESC`` cancels it. This
feature was taken from `stepb`_ tabbedx repository.
.. _urxvt-unicode: http://software.schmorp.de/pkg/rxvt-unicode.html
.. _activity indicator: http://mina86.com/2009/05/16/tabbed-urxvt-extension/

View File

@@ -139,6 +139,9 @@
#
# 2022-02-20 18:31:19
# - Fixed nasty bug in renaming tab.
#
# 2022-02-22 16:49:18
# - Added feature with autohide tabbar, if there is only single tab
use Scalar::Util;
@@ -240,6 +243,19 @@ sub tab_term_init {
sub refresh {
my ($self) = @_;
my $tabs_no = (@{$self->{tabs}});
if (! $self->{new_button} && $self->{autohide} && $tabs_no == 1 &&
! $self->{cur}->{is_being_renamed}) {
$self->{tabheight} = 0;
$self->configure;
$self->copy_properties;
return;
} else {
$self->{tabheight} = $self->{_tab_height_if_visible};
$self->configure;
$self->copy_properties;
}
my $ncol = $self->ncol;
@@ -519,6 +535,7 @@ sub init {
$self->{rs_tab_acs} = urxvt::SET_COLOR(urxvt::DEFAULT_RSTYLE, $actives + 2, $bg + 2);
$self->{rs_tab_acd} = urxvt::SET_COLOR(urxvt::DEFAULT_RSTYLE, $actived + 2, $bg + 2);
$self->{set_default_keys} = (! $self->x_resource_boolean('disable-default-keys'));
$self->{autohide} = $self->x_resource_boolean('autohide');
my $timeouts = $self->x_resource ("tabbar-timeouts");
$timeouts = '16:.:8:::4:+' unless defined $timeouts;
@@ -544,10 +561,12 @@ sub init {
}
_on start => sub {
_on start => sub {
my ($self) = @_;
$self->{tabheight} = $self->int_bwidth + $self->fheight + $self->lineSpace;
$self->{_tab_height_if_visible} = $self->int_bwidth + $self->fheight +
$self->lineSpace;
$self->{tabheight} = $self->{autohide}? 0 : $self->{_tab_height_if_visible};
$self->cmd_parse ("\033[?25l");