Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

Re^2: scripting i3 with Perl

by morgon (Priest)
on Feb 02, 2019 at 07:38 UTC ( #1229277=note: print w/replies, xml ) Need Help??

in reply to Re: scripting i3 with Perl
in thread scripting i3 with Perl

Thanks for the reply.

Your attempt gets rid of the error message and prints "Switched back...", however the switch itself does not happen - the command does not seem to be executed...

Replies are listed 'Best First'.
Re^3: scripting i3 with Perl
by Corion (Patriarch) on Feb 02, 2019 at 08:31 UTC

    Maybe there is an error? The AnyEvent::i3 documentation mentions that ->command returns a result:

    use Data::Dumper; sub handle { my($data)=@_; if($data->{change} eq "empty") { print "empty workspace!!\n"; my $switched; $switched = $i3->command("workspace 1")->cb(sub { my( $reply ) = @_; print "Switched back to workspace 1\n"; undef $switched; use Data::Dumper; print Dumper $reply; }); } }
      This is what I get:
      empty workspace!! Switched back to workspace 1 $VAR1 = bless( { '_ae_sent' => [ [ { 'success' => bless( do{\(my $o = +1)}, 'JSON::PP::Boolean' ) } ] ] }, 'AnyEvent::CondVar' );
      However no switching occurs. No clue what is going on there...

        So, the i3 API tells you that all is well. This sounds more like a problem with i3 to me. Maybe consider delaying the switching a bit. Set a timer (AnyEvent->timer(after => 3, sub {...}) and trigger the desktop switch from that timed callback instead of triggering it directly.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1229277]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (1)
As of 2023-03-21 18:21 GMT
Find Nodes?
    Voting Booth?
    Which type of climate do you prefer to live in?

    Results (60 votes). Check out past polls.