summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2021-01-09 03:55:19 +0000
committerjao <jao@gnu.org>2021-01-09 03:55:19 +0000
commite77480f93ddecba06504f00c5c8e52f00b86ed42 (patch)
treeae20a9f92f57d24850f57842316630875582c036 /src
parentd4f0550b65166a6448d68298db3b919872144f18 (diff)
downloadxmobar-config-e77480f93ddecba06504f00c5c8e52f00b86ed42.tar.gz
xmobar-config-e77480f93ddecba06504f00c5c8e52f00b86ed42.tar.bz2
more playing with wttr
Diffstat (limited to 'src')
-rw-r--r--src/TopC.hs15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/TopC.hs b/src/TopC.hs
index 4255b41..ebf21d0 100644
--- a/src/TopC.hs
+++ b/src/TopC.hs
@@ -3,6 +3,9 @@ import Config
import Monitors
import Music (mpris, gpmd, mpdt)
+import qualified Data.Char as Char
+import qualified Text.Printf as Printf
+
memoratio = Memory ["-t","<usedratio>%", "-p", "2", "-W", "3"] 20
topProcL p = TopProc (p <~> ["-t"
@@ -38,15 +41,21 @@ musicMPRIS p = mpris p mprisName 180
music = concatMonitor (fni " \xf1bc ")
(mpd "mpd" "6600" "<remaining>")
(mpd "mopidy" "6669" "<ppos>/<plength> <remaining>")
-
-wttrURL = "https://wttr.in?format=%3Cfn%3D3%3E%c%3C%2Ffn%3E+%t+%C"
+-- "https://wttr.in?format=" ++ fnn 3 "%c" ++ "+%t+%C+%w++" ++ fnn 1 "%m"
+wttrURL = "https://wttr.in?format=" ++ fnn 2 "+%m+" ++ "+%t+%C+" ++ fn 5 "%w"
+ where fnn n x = urlEncode ("<fn=" ++ show n ++ ">") ++ x ++ urlEncode "</fn>"
+ encode c
+ | c == ' ' = "+"
+ | Char.isAlphaNum c || c `elem` "-._~" = [c]
+ | otherwise = Printf.printf "%%%02X" c
+ urlEncode = concatMap encode
config p = (baseConfig p) {
position = TopSize C 100 (defaultHeight - 1)
, textOffset = defaultHeight - 8
, textOffsets = [defaultHeight - 9, defaultHeight - 9,
defaultHeight - 6, defaultHeight - 8,
- -1, defaultHeight - 8]
+ defaultHeight - 8, defaultHeight - 8]
, border = FullB
, alpha = 255
, commands = [ Run (topProcL p)