Include workspace con in workspace event
Send the affected workspace in the "current" property for each workspace event for any type of workspace event that affects a particular workspace. fixes #1411
This commit is contained in:
committed by
Michael Stapelberg
parent
04fa40d3e5
commit
823b46a544
@ -23,7 +23,7 @@ $i3->connect()->recv;
|
||||
# Workspaces requests and events
|
||||
################################
|
||||
|
||||
my $focused = get_ws(focused_ws());
|
||||
my $old_ws = get_ws(focused_ws());
|
||||
|
||||
# Events
|
||||
|
||||
@ -36,15 +36,11 @@ $i3->subscribe({
|
||||
workspace => sub {
|
||||
my ($event) = @_;
|
||||
if ($event->{change} eq 'init') {
|
||||
$init->send(1);
|
||||
$init->send($event);
|
||||
} elsif ($event->{change} eq 'focus') {
|
||||
# Check that we have the old and new workspace
|
||||
$focus->send(
|
||||
$event->{current}->{name} == '2' &&
|
||||
$event->{old}->{name} == $focused->{name}
|
||||
);
|
||||
$focus->send($event);
|
||||
} elsif ($event->{change} eq 'empty') {
|
||||
$empty->send(1);
|
||||
$empty->send($event);
|
||||
}
|
||||
}
|
||||
})->recv;
|
||||
@ -61,8 +57,20 @@ $t = AnyEvent->timer(
|
||||
}
|
||||
);
|
||||
|
||||
ok($init->recv, 'Workspace "init" event received');
|
||||
ok($focus->recv, 'Workspace "focus" event received');
|
||||
ok($empty->recv, 'Workspace "empty" event received');
|
||||
my $init_event = $init->recv;
|
||||
my $focus_event = $focus->recv;
|
||||
my $empty_event = $empty->recv;
|
||||
|
||||
my $current_ws = get_ws(focused_ws());
|
||||
|
||||
ok($init_event, 'workspace "init" event received');
|
||||
is($init_event->{current}->{id}, $current_ws->{id}, 'the "current" property should contain the initted workspace con');
|
||||
|
||||
ok($focus_event, 'workspace "focus" event received');
|
||||
is($focus_event->{current}->{id}, $current_ws->{id}, 'the "current" property should contain the focused workspace con');
|
||||
is($focus_event->{old}->{id}, $old_ws->{id}, 'the "old" property should contain the workspace con that was focused last');
|
||||
|
||||
ok($empty_event, 'workspace "empty" event received');
|
||||
is($empty_event->{current}->{id}, $old_ws->{id}, 'the "current" property should contain the emptied workspace con');
|
||||
|
||||
done_testing;
|
||||
|
Reference in New Issue
Block a user