]>
Commit | Line | Data |
---|---|---|
1 | #!/usr/bin/env perl | |
2 | ||
3 | use strict; | |
4 | use warnings; | |
5 | use Text::Template 'fill_in_string'; | |
6 | use AnyEvent::I3; | |
7 | use v5.10; | |
8 | ||
9 | my $i3 = i3(); | |
10 | $i3->connect->recv or die "Error connecting to i3"; | |
11 | ||
12 | my ($ev, $str) = @ARGV; | |
13 | if (not defined $str) { | |
14 | die "Error: Too few arguments\n" . | |
15 | "Usage: $0 workspace|output|mode|window|barconfig_update|binding format_string\n" . | |
16 | "Example: $0 window 'The window title is {\$name}'" | |
17 | } | |
18 | ||
19 | $i3->subscribe({ | |
20 | $ev => sub { | |
21 | # XXX: there has to be a way to make this one line | |
22 | my ($msg) = @_; | |
23 | # XXX: not escaped | |
24 | say Text::Template::fill_in_string($str, HASH=>$msg->{'container'}); | |
25 | } | |
26 | })->recv; | |
27 | ||
28 | AE::cv->recv; | |
29 | ||
30 | # vim: et:ts=4:sts=4:sw=4 |