#!/usr/bin/env perl use strict; use warnings; use Text::Template 'fill_in_string'; use AnyEvent::I3; use v5.10; my $i3 = i3(); $i3->connect->recv or die "Error connecting to i3"; my ($ev, $str) = @ARGV; if (not defined $str) { die "Error: Too few arguments\n" . "Usage: $0 workspace|output|mode|window|barconfig_update|binding format_string\n" . "Example: $0 window 'The window title is {\$name}'" } $i3->subscribe({ $ev => sub { # XXX: there has to be a way to make this one line my ($msg) = @_; # XXX: not escaped say Text::Template::fill_in_string($str, HASH=>$msg->{'container'}); } })->recv; AE::cv->recv; # vim: et:ts=4:sts=4:sw=4