From d4f0550b65166a6448d68298db3b919872144f18 Mon Sep 17 00:00:00 2001 From: jao Date: Thu, 7 Jan 2021 17:39:46 +0000 Subject: wttr: make do with a single curl call --- src/TopC.hs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/TopC.hs b/src/TopC.hs index c2c3426..4255b41 100644 --- a/src/TopC.hs +++ b/src/TopC.hs @@ -3,6 +3,8 @@ import Config import Monitors import Music (mpris, gpmd, mpdt) +memoratio = Memory ["-t","%", "-p", "2", "-W", "3"] 20 + topProcL p = TopProc (p <~> ["-t" , " " ++ " · " @@ -37,6 +39,8 @@ music = concatMonitor (fni " \xf1bc ") (mpd "mpd" "6600" "") (mpd "mopidy" "6669" "/ ") +wttrURL = "https://wttr.in?format=%3Cfn%3D3%3E%c%3C%2Ffn%3E+%t+%C" + config p = (baseConfig p) { position = TopSize C 100 (defaultHeight - 1) , textOffset = defaultHeight - 8 @@ -50,7 +54,7 @@ config p = (baseConfig p) { , Run (thinkTemp p) , Run (NamedXPropertyLog "_EMACS_LOG" "elog") , Run (cpuBars p) - , Run memory + , Run memoratio , Run (diskU p) , Run (diskIOL p) , Run brightness' @@ -64,8 +68,7 @@ config p = (baseConfig p) { , Run laTime , Run localTime -- , Run w -- LEGE, LEBL, KCV0 - , Run (Com "curl" ["https://wttr.in?format=%c"] "wttr" 20000) - , Run (Com "curl" ["https://wttr.in?format=%t+%C"] "wttrT" 20000) + , Run (ComX "curl" [wttrURL] "" "wttr" 18000) ] , template = " " ++ "|batt0| " @@ -77,7 +80,7 @@ config p = (baseConfig p) { ++ " " ++ ma -- ++ " |EGPH| " - ++ fn 3 " |wttr| " ++ "|wttrT|" + ++ " |wttr|" ++ " {} " ++ fc (pHigh p) "|elog|" ++ "|kbd| " @@ -91,7 +94,7 @@ config p = (baseConfig p) { } where dimi = fc (pDim p) . fni m = music ma = dimi "\xf001" ++ " |" ++ alias m ++ "| " - w = (weather' " ° " "EGPH" p) +-- w = (weather' " ° " "EGPH" p) main :: IO () main = palette >>= configFromArgs . config >>= xmobar -- cgit v1.2.3