I am having problems scripting the window-manager i3 with perl using AnyEvent::I3 and as I could not get any help in an i3-forum, I try my luck here...
This works:
Running this changes to workspace 1.use strict; use AnyEvent; use AnyEvent::I3; my $i3 = i3(); $i3->connect->recv or die "Error connecting to i3"; $i3->command("workspace 1")->recv;
And this also works:
Running this prints "empty workspace!!" whenever a workspace become empty.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"; } }
What I want now is to combine the logic, so whenever a workspace becomes empty we change to workspace 1.
Here is my attempt:
However this does not work. It prints "empty workspace!!" ok, but it does not send the command, the error is: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"; $i3->command("workspace 1")->recv; } }
Any ideas?EV: error in callback (ignoring): AnyEvent::CondVar: recursive blockin +g wait attempted
Many thanks!
In reply to scripting i3 with Perl by morgon
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |