summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2018-11-11 00:44:59 -0500
committerJesse Luehrs <doy@tozt.net>2018-11-11 00:56:04 -0500
commit0a41deb9c67172c0597a0ac9e029c54640d03758 (patch)
treebc2bde734dd2b599af09e94bd78693913d198903 /bin
parentc12f2bec67cd1964ec8bb3c524e83582b729282c (diff)
downloadconf-0a41deb9c67172c0597a0ac9e029c54640d03758.tar.gz
conf-0a41deb9c67172c0597a0ac9e029c54640d03758.zip
display temperature in celsius
Diffstat (limited to 'bin')
-rwxr-xr-xbin/hush/status12
-rwxr-xr-xbin/hush/weather2
2 files changed, 7 insertions, 7 deletions
diff --git a/bin/hush/status b/bin/hush/status
index 420f374..d068a17 100755
--- a/bin/hush/status
+++ b/bin/hush/status
@@ -123,16 +123,16 @@ sub handle_i3status {
if (-r $weather_file && -f $weather_file) {
my $weather = slurp($weather_file);
chomp($weather);
- my ($temp) = $weather =~ /\d+%.*?(-?\d+)F.*?-?\d+F/;
+ my ($temp) = $weather =~ /\d+%.*?(-?\d+)C.*?-?\d+C/;
unshift @$line, {
name => 'weather',
full_text => $weather,
color => (
- $temp >= 90 ? '#FF0000'
- : $temp >= 78 ? '#FFFF00'
- : $temp >= 73 ? '#00FF00'
- : $temp >= 55 ? '#FFFFFF'
- : $temp >= 32 ? '#CDCDFF'
+ $temp >= 30 ? '#FF0000'
+ : $temp >= 25 ? '#FFFF00'
+ : $temp >= 20 ? '#00FF00'
+ : $temp >= 10 ? '#FFFFFF'
+ : $temp >= 0 ? '#CDCDFF'
: '#0000FF'
),
};
diff --git a/bin/hush/weather b/bin/hush/weather
index 09e5fa0..6d762d7 100755
--- a/bin/hush/weather
+++ b/bin/hush/weather
@@ -35,7 +35,7 @@ if (length($location) == 5) {
$location = zip_location($location);
}
-my $data = slurp_http("https://api.darksky.net/forecast/$api_key/$location");
+my $data = slurp_http("https://api.darksky.net/forecast/$api_key/$location?units=si");
my $hour = (localtime(int($data->{currently}{time})))[2];
my $temp = int($data->{currently}{temperature});