summaryrefslogtreecommitdiffhomepage
path: root/src/Xmobar/Plugins/Monitors/Weather.hs
diff options
context:
space:
mode:
authorslotThe <soliditsallgood@tuta.io>2019-12-23 16:22:10 +0100
committerslotThe <soliditsallgood@tuta.io>2019-12-23 16:39:15 +0100
commit212b9c15ce5836c58716161191c3e3cf0df80093 (patch)
tree083c5afd65f5249d0e4b77baeff836d2e17b8284 /src/Xmobar/Plugins/Monitors/Weather.hs
parent40e7ffab568deeb95b6f641663be7577036a6ca1 (diff)
downloadxmobar-212b9c15ce5836c58716161191c3e3cf0df80093.tar.gz
xmobar-212b9c15ce5836c58716161191c3e3cf0df80093.tar.bz2
Add support for the "Weather" field
Diffstat (limited to 'src/Xmobar/Plugins/Monitors/Weather.hs')
-rw-r--r--src/Xmobar/Plugins/Monitors/Weather.hs9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/Xmobar/Plugins/Monitors/Weather.hs b/src/Xmobar/Plugins/Monitors/Weather.hs
index fb5732b..6ac1f4b 100644
--- a/src/Xmobar/Plugins/Monitors/Weather.hs
+++ b/src/Xmobar/Plugins/Monitors/Weather.hs
@@ -45,6 +45,7 @@ weatherConfig = mkMConfig
, "visibility"
, "skyCondition"
, "skyConditionS"
+ , "weather"
, "tempC"
, "tempF"
, "dewPointC"
@@ -73,6 +74,7 @@ data WeatherInfo =
, windInfo :: WindInfo
, visibility :: String
, skyCondition :: String
+ , weather :: String
, tempC :: Int
, tempF :: Int
, dewPointC :: Int
@@ -169,6 +171,7 @@ parseData =
w <- pWind
v <- getAfterString "Visibility: "
sk <- getAfterString "Sky conditions: "
+ we <- getAfterString "Weather: "
skipTillString "Temperature: "
(tC,tF) <- pTemp
skipTillString "Dew Point: "
@@ -178,7 +181,7 @@ parseData =
skipTillString "Pressure (altimeter): "
p <- pPressure
manyTill skipRestOfLine eof
- return [WI st ss y m d h w v sk tC tF dC dF rh p]
+ return [WI st ss y m d h w v sk we tC tF dC dF rh p]
defUrl :: String
defUrl = "https://tgftp.nws.noaa.gov/data/observations/metar/decoded/"
@@ -201,12 +204,12 @@ formatSk ((a,b):sks) sk = if a == sk then b else formatSk sks sk
formatSk [] sk = sk
formatWeather :: [(String,String)] -> [WeatherInfo] -> Monitor String
-formatWeather sks [WI st ss y m d h (WindInfo wc wa wm wk wkh wms) v sk tC tF dC dF r p] =
+formatWeather sks [WI st ss y m d h (WindInfo wc wa wm wk wkh wms) v sk we tC tF dC dF r p] =
do cel <- showWithColors show tC
far <- showWithColors show tF
let sk' = formatSk sks (map toLower sk)
parseTemplate [st, ss, y, m, d, h, wc, wa, wm, wk, wkh
- , wms, v, sk, sk', cel, far
+ , wms, v, sk, sk', we, cel, far
, show dC, show dF, show r , show p ]
formatWeather _ _ = getConfigValue naString