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

Added ability to jump to last tab.

This commit is contained in:
2022-02-23 20:06:41 +01:00
parent b0e86d5370
commit dbb12e9dda
2 changed files with 33 additions and 1 deletions

View File

@@ -30,6 +30,7 @@ Features
* 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.
* Ability to assign hotkey to jump to last tab.
Installation
------------
@@ -209,6 +210,33 @@ It might be wise to define own shortcuts before disabling default keys.
URxvt.keysym.Control-r: tabbedalt:rename_tab
Jump to last tab
~~~~~~~~~~~~~~~~
There is a possibility to tell tabbedalt to use ``jump_to_tab`` action to jump
to the last (rightmost) tab, instead of 10th. It can be done by setting
resource::
URxvt.tabbedalt.zero-jump-last: true
so whatever keysym is assigned to ``tabbedalt:jump_to_tab:0`` will select last
tab, regardless if current number of tabs is more or less than 10. There is
still a way for selecting 10th tab, i.e.::
URxvt.tabbedalt.zero-jump-last: true
URxvt.keysym.Control-F1: tabbedalt:jump_to_tab:1
URxvt.keysym.Control-F2: tabbedalt:jump_to_tab:2
URxvt.keysym.Control-F10: tabbedalt:jump_to_tab:10
URxvt.keysym.Control-F11: tabbedalt:jump_to_tab:11
URxvt.keysym.Control-F12: tabbedalt:jump_to_tab:12
URxvt.keysym.Control-0: tabbedalt:jump_to_tab:0
In the example above, there are mapping for jump to tabs 1 - 12 using function
keys, and `Control+0` to jump whatever last tab is.
Creating custom classes
-----------------------

View File

@@ -142,6 +142,9 @@
#
# 2022-02-22 16:49:18
# - Added feature with autohide tabbar, if there is only single tab
#
# 2022-02-23 20:03:33
# - Added jump to last tab feature
use Scalar::Util;
@@ -536,6 +539,7 @@ sub init {
$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');
$self->{zero_jump_last} = $self->x_resource_boolean('zero-jump-last');
my $timeouts = $self->x_resource ("tabbar-timeouts");
$timeouts = '16:.:8:::4:+' unless defined $timeouts;
@@ -730,7 +734,7 @@ sub jump_to_tab {
shift @args; # remove command
my $nr = $args[0];
if ($nr == 0) {
$nr = 10;
if ($self->{zero_jump_last}) { $nr = 0 } else { $nr = 10 }
}
$nr--;