diff --git a/testcases/t/166-assign.t b/testcases/t/166-assign.t index 38797565..8d05c05b 100644 --- a/testcases/t/166-assign.t +++ b/testcases/t/166-assign.t @@ -192,6 +192,22 @@ sleep 0.25; # ticket #501 ##################################################################### +# Walks /proc to figure out whether a child process of $i3pid with the name +# 'i3-nagbar' exists. +sub i3nagbar_running { + my ($i3pid) = @_; + + my @procfiles = grep { m,^/proc/[0-9]+$, } ; + for my $path (@procfiles) { + open(my $fh, '<', "$path/stat") or next; + my $line = <$fh>; + close($fh); + my ($comm, $ppid) = ($line =~ /^[0-9]+ \(([^)]+)\) . ([0-9]+)/); + return 1 if $ppid == $i3pid && $comm eq 'i3-nagbar'; + } + return 0; +} + $config = <