aboutsummaryrefslogtreecommitdiff
path: root/extras
diff options
context:
space:
mode:
Diffstat (limited to 'extras')
-rwxr-xr-xextras/HOME/.xmonad/xmobar-weather103
1 files changed, 0 insertions, 103 deletions
diff --git a/extras/HOME/.xmonad/xmobar-weather b/extras/HOME/.xmonad/xmobar-weather
deleted file mode 100755
index b95fadb..0000000
--- a/extras/HOME/.xmonad/xmobar-weather
+++ /dev/null
@@ -1,103 +0,0 @@
-#!/usr/bin/perl
-
-use Time::Local;
-use POSIX;
-
-$content = `curl https://ipinfo.io`;
-
-die "Unable to get IP info" unless defined $content;
-
-($city, $lat, $lon) =
- ($content =~ m/.*"city":\s+"([^"]+)".*"loc":\s+"(-?[0-9.]+),(-?[0-9.]+).*"/ims);
-
-$content = `curl "https://api.sunrise-sunset.org/json?lat=$lat&lng=$lon&formatted=0"`;
-
-die "Unable to get sunrise/sunset data" unless defined $content;
-
-if (length($content) == 0) {
- printf("<fc=#404040></fc> ");
- exit
-}
-
-$sunrise_str=$content;
-$sunset_str=$content;
-$sunrise_str =~ s#.*"sunrise":"([^"]*)".*#\1#;
-$sunset_str =~ s#.*"sunset":"([^"]*)".*#\1#;
-$current_str=strftime "%Y-%m-%dT%H:%M:%S+00:00", gmtime();
-
-$content = `curl "https://tgftp.nws.noaa.gov/data/observations/metar/decoded/KLMO.TXT"`;
-
-die "Unable to get weather data" unless defined $content;
-
-$sky_conditions = $content;
-$sky_conditions =~ s#.*Sky conditions:\s+([^\n]+).*#\1#ims;
-$sky_conditions =~ s#\s#_#g;
-
-$wind = $content;
-$wind =~ s#.*Wind:\s+([^\n]+).*#\1#ims;
-($wind_direction, $wind_speed) =
- ($wind =~ m/from the ([A-Z]+).*at (\d+) MPH.*/g);
-
-
-$temp = $content;
-$temp =~ s#.*Temperature:\s+(-?[0-9.]+) F.*#\1#ims;
-
-if ($current_str gt $sunrise_str and $current_str lt $sunset_str) {
- $is_day = 1;
-} else {
- $is_day = 0;
-}
-
-%directions = (
- NE => "",
- NNE => "",
- ENE => "",
- SE => "",
- SSE => "",
- ESE => "",
- NW => "",
- NNW => "",
- WNW => "",
- SW => "",
- SSW => "",
- WSW => "",
- N => "",
- S => "",
- W => "",
- E => "" );
-
-$dir=%directions{$wind_direction};
-
-%conditions_day = (
- clear => "<fc=#ddcf04></fc> ",
- sunny => "<fc=#ddcf04></fc> ",
- mostly_clear => "<fc=#00a3c4></fc> ",
- mostly_sunny => "<fc=#ddcf04></fc> ",
- partly_sunny => "<fc=#ddcf04></fc> ",
- fair => "<fc=#a0a0a0>🌑</fc> ",
- cloudy =>"<fc=#a0a0a0>摒</fc> ",
- overcast =>"<fc=#808080></fc> ",
- partly_cloudy => "<fc=#a0a0a0>杖</fc> ",
- mostly_cloudy => "<fc=#808080></fc> ",
- considerable_cloudiness => "<fc=#a0a0a0>ﭽ</fc> " );
-
-%conditions_night = (
- clear => "<fc=#00a3c4></fc> ",
- sunny => "<fc=#00a3c4></fc> ",
- mostly_clear => "<fc=#00a3c4></fc> ",
- mostly_sunny => "<fc=#00a3c4></fc> ",
- partly_sunny => "<fc=#00a3c4></fc> ",
- fair => "<fc=#808080>🌑</fc> ",
- cloudy =>"<fc=#808080>摒</fc> ",
- overcast =>"<fc=#404040></fc> ",
- partly_cloudy => "<fc=#a0a0a0></fc> ",
- mostly_cloudy => "<fc=#808080></fc> ",
- considerable_cloudiness => "<fc=#a0a0a0>ﭽ</fc> " );
-
-if ($is_day) {
- $conditions = %conditions_day{$sky_conditions};
-} else {
- $conditions = %conditions_night{$sky_conditions};
-}
-
-printf("<fc=#a0a0a0><fn=3>$city</fn> <fn=3>$dir</fn> <fn=3>${wind_speed}</fn></fc> <fn=8>$conditions</fn><fn=3><fc=#a0a0a0>%.0f°F</fc></fn>\n", $temp);