/[scripts]/trunk/dwm-status.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/dwm-status.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 55 by dpavlin, Tue Oct 2 16:10:08 2007 UTC revision 59 by dpavlin, Fri Jan 18 19:10:10 2008 UTC
# Line 8  use strict; Line 8  use strict;
8  use POSIX qw/strftime/;  use POSIX qw/strftime/;
9  use File::Slurp;  use File::Slurp;
10  use Time::HiRes;  use Time::HiRes;
11  eval {  use Data::Dump qw/dump/;
         use Data::Dump qw/dump/;  
 };  
12    
13  my $dt = 3;  my $dt = 3;
14  my $acpi_every = 10;  my $acpi_every = 10;
# Line 58  find_proc_acpi('thermal_zone', sub { Line 56  find_proc_acpi('thermal_zone', sub {
56    
57  find_proc_acpi('battery', sub {  find_proc_acpi('battery', sub {
58          my $bat = shift;          my $bat = shift;
59          return unless $bat =~ /BAT/;          return unless $bat =~ /\w+/;
60    
61          warn "# testing battery $bat\n" if ( $debug );          warn "# testing battery $bat\n" if ( $debug );
62    
# Line 96  my $bat; Line 94  my $bat;
94    
95  my $i = 0;  my $i = 0;
96    
97    
98  while ( 1 ) {  while ( 1 ) {
99          my $s = strftime("%Y-%m-%d %H:%M:%S", localtime());          my $s = strftime("%Y-%m-%d %H:%M:%S", localtime());
100    
# Line 179  while ( 1 ) { Line 178  while ( 1 ) {
178          my $d_write = ( $d_w - $ld_w ) / $dt;          my $d_write = ( $d_w - $ld_w ) / $dt;
179          ( $ld_r, $ld_w ) = ( $d_r, $d_w );          ( $ld_r, $ld_w ) = ( $d_r, $d_w );
180    
181          printf("%s | %s |%5s D %-5s|%5s > %-5s| %s%s\n",          my $out = sprintf("%s | %s |%5s D %-5s|%5s > %-5s| %s%s\n",
182                  $s,                  $s,
183                  $load,                  $load,
184                  unit( $d_read ), unit( $d_write ),                  unit( $d_read ), unit( $d_write ),
# Line 187  while ( 1 ) { Line 186  while ( 1 ) {
186                  $bat, $temp,                  $bat, $temp,
187          );          );
188    
189            print $out;
190    
191          sleep $dt;          sleep $dt;
192  }  }
193    

Legend:
Removed from v.55  
changed lines
  Added in v.59

  ViewVC Help
Powered by ViewVC 1.1.26