diff options
author | jao <jao@gnu.org> | 2021-01-09 03:55:19 +0000 |
---|---|---|
committer | jao <jao@gnu.org> | 2021-01-09 03:55:19 +0000 |
commit | e77480f93ddecba06504f00c5c8e52f00b86ed42 (patch) | |
tree | ae20a9f92f57d24850f57842316630875582c036 | |
parent | d4f0550b65166a6448d68298db3b919872144f18 (diff) | |
download | xmobar-config-e77480f93ddecba06504f00c5c8e52f00b86ed42.tar.gz xmobar-config-e77480f93ddecba06504f00c5c8e52f00b86ed42.tar.bz2 |
more playing with wttr
-rwxr-xr-x | bin/run-trayer.sh | 2 | ||||
-rw-r--r-- | src/TopC.hs | 15 |
2 files changed, 13 insertions, 4 deletions
diff --git a/bin/run-trayer.sh b/bin/run-trayer.sh index 0b1a0fa..f029c7c 100755 --- a/bin/run-trayer.sh +++ b/bin/run-trayer.sh @@ -9,7 +9,7 @@ # --alpha 255 --padding 1 trayer --margin 2 --distancefrom left \ - --distance 1 --edge bottom \ + --distance 1 --edge top \ --align left --SetDockType true --SetPartialStrut false \ --widthtype request \ --height 21 --heighttype pixel \ 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) |