dotfiles/urxvt/ext/close-prompt

18 lines
402 B
Plaintext
Raw Normal View History

2018-12-03 10:39:04 +00:00
#!/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;
}