1
0
mirror of https://github.com/gryf/tabbedalt.git synced 2025-12-18 03:50:32 +01:00

Added default shortcut for the new tab creation.

In my derivation I arbitrary choose ctrl+shift+n as a shortcut for
creating new shell tab. There was a bug, when user created some other
class (for example for midnight commander and root) and with such
configuration it will unable to create default shell tabs.

This change introduces standard shortcut from original tabbed extension
(shift+down) as a default one for creating shell tabs. All the shell
classes can be configured and used as before.

Shift+down shortcut can be disabled, and now, "new style" - ctrl+shift+n
shortcut would be used for that purpose, unless user provide its own
class definition for that shortcut, than user responsibility is to make
appropriate shortcut for default shell.
This commit is contained in:
2019-09-13 19:14:49 +02:00
parent 5588a30dd4
commit 317f614e8f
2 changed files with 47 additions and 17 deletions

22
tabbed
View File

@@ -107,7 +107,10 @@
# 2019-06-05 10:55:37
# - fixed couple of bugs regarding session
# - changed default colors to more sane values
#
# 2019-09-13 15:15:18
# - Added shortcut for creating new shell like in original tabbed
# (SHIFT+Down). It can be disabled by an option "disable-shift-down".
sub tab_activity_mark ($$) {
my ($self, $tab) = @_;
@@ -417,6 +420,10 @@ sub on_init {
$self->{tab_numbers} =
($self->x_resource ('tab-numbers') or 'true') !~ /^(?:false|0|no)/i;
$self->{disable_shift_down} =
($self->x_resource ('disable-shift-down')
or 'false') =~ /^(?:true|1|yes)/i;
%{$self->{tabcmds}} = ();
for (my $idx = 1; defined (my $res = $self->x_resource("tabcmds.$idx")); $idx++){
chomp($res);
@@ -557,14 +564,12 @@ sub tab_key_press {
if ($event->{state} & urxvt::ShiftMask) {
if ($event->{state} & urxvt::ControlMask) {
if(not %{$self->{tabcmds}}){
if ($keysym == 0x4e){
$self->new_tab("shell");
return 1;
}
}elsif(exists($self->{tabcmds}{chr($keysym)})){
if (exists($self->{tabcmds}{chr($keysym)})) {
$self->new_tab(@{$self->{tabcmds}{chr($keysym)}});
return 1;
} elsif ($self->{disable_shift_down} and $keysym == 0x4e) {
$self->new_tab("shell");
return 1;
}
}elsif ($keysym == 0xff51 || $keysym == 0xff53) {
my ($idx) = grep $self->{tabs}[$_] == $tab, 0 .. $#{ $self->{tabs} };
@@ -582,6 +587,9 @@ sub tab_key_press {
$tab->{name} = "█";
$self->refresh;
return 1;
} elsif (not $self->{disable_shift_down} and $keysym == 0xff54) {
$self->new_tab("shell");
return 1;
}
}
elsif ($event->{state} & urxvt::ControlMask) {