8 my $temperature_path = '/sys/devices/virtual/hwmon/hwmon0/temp1_input';
9 my $critical_path = '/sys/devices/virtual/hwmon/hwmon0/temp1_crit';
11 # No temperature information available.
12 if (! -e $temperature_path || ! -e $critical_path) {
16 my $screen_mode = (defined $ARGV[0] and $ARGV[0] eq '-s');
17 my $tmux_mode = (defined $ARGV[0] and $ARGV[0] eq '-t');
23 open $file, '<', $temperature_path or die $!;
24 $temperature = <$file>;
26 open $file, '<', $critical_path or die $!;
30 my $value = int($temperature / 1000);
31 my $risk = ($critical - $temperature)/$critical;
33 # GNU screen mode with colors.
37 $color = 'br r'; # bold reverse
38 } elsif ($risk < 0.1) {
40 } elsif ($risk < 0.2) {
46 print "\005{+$color}$value\005{-}\n";
49 } elsif ($tmux_mode) {
54 $style = 'reverse'; # blink doesn't work for me
55 } elsif ($risk < 0.1) {
57 } elsif ($risk < 0.2) {
63 print "#[fg=$color,$style]$value#[default]\n";