use strict; use AnyEvent; use AnyEvent::I3; my $i3 = i3(); $i3->connect->recv or die "Error connecting to i3"; $i3->subscribe({ workspace => \&handle })->recv->{success} or die "Error subscribing to events"; AE::cv->recv; sub handle { my($data)=@_; if($data->{change} eq "empty") { print "empty workspace!!\n"; } }