diff options
| -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) | 
