Commenting out one line in the tabbedex extension can keep your URxvt windows from closing accidentally.

I must have re-installed the tabbedex extension and forgot to add this step until URxvt reminded me the hard way a moment ago.

If you’ve ever accidentally killed a terminal instance (or, even worse, a terminal with multiple tabs running), this tip is for you.

To keep from absentmindedly typing Ctrl-w or Alt-F4 and killing your terminal, you can comment out one line in the tabbedex extension to prevent it from ever happening again.

Locate the following code in your tabbedex extension file. The file is probably located somewhere near /usr/local/lib/urxvt/perl/tabbedex, or the equivalent on your system.

This is the Perl code snippet to look for:

sub on_wm_delete_window {
my ($self) = @_;
$_->destroy for @{ $self->{tabs} };
1;
}

All you have to do is comment out one line, as shown below.

sub on_wm_delete_window {
my ($self) = @_;
# $_->destroy for @{ $self->{tabs} };
1;
}

To be sure that you see it, here is the line that was commented out:

$_->destroy for @{ $self->{tabs} };

became

# $_->destroy for @{ $self->{tabs} };

After commenting out that line, you will no longer have to deal with accidentally closing your URxvt windows. The terminal instance will only close after all individual tabs are exited, so you can have a bit more peace of mind.

Leave a comment