#!/usr/bin/perl
use warnings;
use strict;

use IO::Socket;

my $d = $ENV{DISPLAY};
$d =~ s/^:(\d+).*$/$1/;
my $path = "$ENV{HOME}/.awesome_ctl.$d";

die "$path doesn't exist!\n" unless -e $path;

warn "# using sock $path\n";

my $msg = '0 widget_tell dwm-status text foobar';

my $sock = IO::Socket::UNIX->new(
	Type  => SOCK_DGRAM,
	Peer => $path,
) or die "Socket: $!";

my $peer = sockaddr_un($path);

$msg .= "\n" . 0x00;

send($sock, $msg,0,$peer) or die "Couldn't send(): $!";

close($sock);
