--- trunk/dwm-status.pl 2007/06/15 20:34:04 40 +++ trunk/dwm-status.pl 2008/04/03 18:39:38 74 @@ -16,6 +16,7 @@ my $disk_blk_size = 512; my $debug = shift @ARGV; +my $awesome = 1; $|=1; @@ -56,7 +57,7 @@ find_proc_acpi('battery', sub { my $bat = shift; - return unless $bat =~ /BAT/; + return unless $bat =~ /\w+/; warn "# testing battery $bat\n" if ( $debug ); @@ -94,6 +95,7 @@ my $i = 0; + while ( 1 ) { my $s = strftime("%Y-%m-%d %H:%M:%S", localtime()); @@ -177,7 +179,7 @@ my $d_write = ( $d_w - $ld_w ) / $dt; ( $ld_r, $ld_w ) = ( $d_r, $d_w ); - printf("%s | %s |%5s D %-5s|%5s > %-5s| %s%s\n", + my $out = sprintf("%s | %s |%5s D %-5s|%5s > %-5s| %s%s\n", $s, $load, unit( $d_read ), unit( $d_write ), @@ -185,6 +187,13 @@ $bat, $temp, ); + print $out; + if ( $awesome ) { + open(my $fh, '|-', 'awesome-client') || die "can't pipe to awesome-client: $!"; + print $fh "0 widget_tell mystatusbar dwm-status text $out\n"; + close($fh); + } + sleep $dt; }