dotfiles/urxvt/ext/close-prompt

18 lines
402 B
Perl

#!/usr/bin/perl
sub on_wm_delete_window {
my ($self, $event) = @_;
my $CP = `ps --ppid $self->{shell_pid} -o pid= | wc -l`;
chomp $CP;
if ( $CP != 0 ) {
return system("zenity --question --title 'Close window' --text 'Subprocess is running. Really close?'")
} else {
return 0;
}
}
sub on_child_start {
my($self, $pid) = @_;
$self->{shell_pid} = $pid;
}