Add a new IPC event for changes on windows.
Added new event id (I3_IPC_EVENT_WINDOW) so that a an IPC client can subscribe to events on windows. Added a basic window event that gets triggered when a window gets successfully reparented. This new event also dumps the container data, so that IPC clients can get the initial window name. IPC clients wishing to see window events should subscribe to 'window'.
This commit is contained in:
committed by
Michael Stapelberg
parent
e215fd43c0
commit
3facbbca5c
43
testcases/t/205-ipc-windows.t
Normal file
43
testcases/t/205-ipc-windows.t
Normal file
@ -0,0 +1,43 @@
|
||||
#!perl
|
||||
# vim:ts=4:sw=4:expandtab
|
||||
#
|
||||
# Please read the following documents before working on tests:
|
||||
# • http://build.i3wm.org/docs/testsuite.html
|
||||
# (or docs/testsuite)
|
||||
#
|
||||
# • http://build.i3wm.org/docs/lib-i3test.html
|
||||
# (alternatively: perldoc ./testcases/lib/i3test.pm)
|
||||
#
|
||||
# • http://build.i3wm.org/docs/ipc.html
|
||||
# (or docs/ipc)
|
||||
#
|
||||
# • http://onyxneon.com/books/modern_perl/modern_perl_a4.pdf
|
||||
# (unless you are already familiar with Perl)
|
||||
|
||||
use i3test;
|
||||
|
||||
my $i3 = i3(get_socket_path());
|
||||
$i3->connect()->recv;
|
||||
|
||||
################################
|
||||
# Window event
|
||||
################################
|
||||
|
||||
# Events
|
||||
|
||||
my $new = AnyEvent->condvar;
|
||||
$i3->subscribe({
|
||||
window => sub {
|
||||
my ($event) = @_;
|
||||
$new->send($event->{change} eq 'new');
|
||||
}
|
||||
})->recv;
|
||||
|
||||
open_window;
|
||||
|
||||
my $t;
|
||||
$t = AnyEvent->timer(after => 0.5, cb => sub { $new->send(0); });
|
||||
|
||||
ok($new->recv, 'Window "new" event received');
|
||||
|
||||
done_testing;
|
Reference in New Issue
Block a user