The i3 FAQ has migrated to All content here is read-only.
Ask Your Question

i3 ipc with libanyevent

asked 2013-03-21 13:20:54 +0000

vandannen gravatar image

updated 2013-03-21 18:23:01 +0000

Currently, I am working on small script for my i3 configuration, which needs to react to the workspace-focus event. At this point, I need both, the old and the current workspace, which should be saved in the eventhandler arguments. But when I try the following snippet with perl and libanyevent, the old and the current workspace objects are identical. Any suggestion why this might be the case?

use strict;
use warnings;
use AnyEvent::I3 qw(:all);
use EV;
use Data::Dumper;

my $i3 = i3("~/.i3/ipc.sock");

$i3->connect->recv or die "Error connecting";

my %handler = (
    workspace => sub {
        my ($msg) = @_;
        if (($msg->{'change'} eq 'focus')) {
            print Dumper($msg);



I am running the latest i3 (v4.5.1) and anyevent-i3 (v0.15).


P.S.: So, I looked into it a bit further, and have to correct myself. The old and current object in the event argument are updated correctly, but are handled seperately for each output monitor. So the old workspace is assigned to the workspace, which was previously focused on the newly focused ouput, and the current workspace refers to the workspace that is now focused on that output. Is this the desired behaviour? I assumed, old would refer to the previously focused workspace across all outputs.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2013-03-21 21:09:42 +0000

Michael gravatar image

updated 2015-10-11 10:18:00 +0000

This sounds like a bug, please report it at

edit flag offensive delete link more


ok, I reported the issue, attached is the oneline change that would need to be done:

vandannen gravatar imagevandannen ( 2013-03-22 00:34:15 +0000 )edit

Question Tools


Asked: 2013-03-21 13:20:54 +0000

Seen: 167 times

Last updated: Oct 11