The i3 FAQ has migrated to https://www.reddit.com/r/i3wm/. All content here is read-only.
Ask Your Question
3

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?

#!/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.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

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 https://github.com/i3/i3/issues

edit flag offensive delete link more

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 ( 2013-03-22 00:34:15 +0000 )edit

Question Tools

Stats

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

Seen: 167 times

Last updated: Oct 11