From dbb12e9ddaca9ae286b6b4ddfa7cee55880654c0 Mon Sep 17 00:00:00 2001 From: gryf Date: Wed, 23 Feb 2022 20:06:41 +0100 Subject: [PATCH] Added ability to jump to last tab. --- README.rst | 28 ++++++++++++++++++++++++++++ tabbedalt | 6 +++++- 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 9006044..96f8d6b 100644 --- a/README.rst +++ b/README.rst @@ -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 ----------------------- diff --git a/tabbedalt b/tabbedalt index c6c1f7c..a5cc3af 100644 --- a/tabbedalt +++ b/tabbedalt @@ -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--;