The error message is pretty descriptive. You are calling ->recv from within a handler. Don't do that.
The following should work:
sub handle { my($data)=@_; if($data->{change} eq "empty") { print "empty workspace!!\n"; my $switched; $switched = $i3->command("workspace 1")->cb(sub { print "Switched back to workspace 1\n"; undef $switched; }); } }
Using AnyEvent, you should basically never call ->recv and only use callbacks except in the outermost program.
In reply to Re: scripting i3 with Perl
by Corion
in thread scripting i3 with Perl
by morgon
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |