The i3 FAQ has migrated to https://github.com/i3/i3/discussions. All content here is read-only.
Ask Your Question
3

i3 ipc with libanyevent

asked Mar 21 '13

vandannen gravatar image

updated Mar 21 '13

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?

#!/usr/bin/perl
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);
        }
    }
);

$i3->subscribe(\%handler)->recv;

EV::loop;

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

Thanks!

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.

1 answer

Sort by » oldest newest most voted
0

answered Mar 21 '13

Michael gravatar image

updated Oct 11 '15

This sounds like a bug, please report it at https://github.com/i3/i3/issues

Comments

ok, I reported the issue, attached is the oneline change that would need to be done: https://github.com/i3/i3/issues/990

vandannen gravatar imagevandannen (Mar 22 '13)edit

Question Tools

Stats

Asked: Mar 21 '13

Seen: 167 times

Last updated: Oct 11