[code]
#!/bin/env -S perl
my( $text, $body);
my $timeout = 0;
my $id = '';
my $id_flag = '';
my $cl_esc = `tput -Tansi.sys-old clear`;
my $tag_open = '';
my $tag_close = '';
print STDERR $cl_esc.$tag_open.`executor-sxhk-keys`.$tag_close;
open my $src, '-|', 'sxhkd -s /dev/stderr 2>&1 >/dev/null';
my $cnt = 0;
while( chomp( $_ = <$src> ))
{
if( /^H(.*)$/ ){
$timeout = 0;
$text = $1;
}
elsif( /^E/ ){ $timeout = 1; $text = undef }
else{ next }
my $tip = $cl_esc.$tag_open;
if( defined $text and $text ne '' ){
$tip = "$tip$text...\n";
$body = `executor-sxhk-keys '$text'`;
$timeout = 1 if $body eq '';
$id = `notify-send -p $id_flag $id -t $timeout -a sxhkd-run '$text...' '$body'`;
$id_flag = '-r';
chomp $id;
} else {
$body = `executor-sxhk-keys`;
$id = `notify-send -p -r $id -t $timeout -a sxhkd '...'`;
$id = '';
$id_flag = '';
}
print STDERR "$tip$body$tag_close"
}
[/code]