diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/TopC.hs | 52 | ||||
| -rw-r--r-- | src/lib/Config.hs | 2 | ||||
| -rw-r--r-- | src/lib/Monitors.hs | 29 | 
3 files changed, 32 insertions, 51 deletions
| diff --git a/src/TopC.hs b/src/TopC.hs index 4a190e0..c8bc447 100644 --- a/src/TopC.hs +++ b/src/TopC.hs @@ -3,9 +3,6 @@ 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" @@ -19,40 +16,11 @@ mpd a p t i =    MPDX [ "-W", "12", "-b", "░", "-f", "▒", "-t", t         , "--", "-p", p, "-P", fni "\xf144", "-Z", i, "-S", i] 20 a - -autoMPD light = AutoMPD [ "-T", "110", "-E", "…", "-W", "10", "-t" , -                          fc "grey40" (fni "\xf001") ++ -                            " <lapsed>/<length> <ppos>/<plength>" --  ++ mpdt light -                        ] - -pollMPD port light = -  MPD [ "-T", "120", "-W", "10", "-E", "…", "-t", tm, "--", "-p", port] 20 -  where tm = fc "grey40" (fni "\xf001") ++ " <remaining> <length> " -   -- ++ "<ppos>/<plength>" -   -- ++ mpdt light - -mprisName = "spotifyd" - -musicPipe = PipeReader "/tmp/music" "musicpipe" -musicMPRIS p = mpris p mprisName 180 - --- music light = toggleMonitor "/tmp/mpris.st" musicPipe (pollMPD light) --- music p = toggleMonitor "/tmp/mpris.st" (pollMPD (pIsLight p)) (musicMPRIS p) --- music port = pollMPD port . pIsLight -music = concatMonitor " " -                      (mpd "mpd" "6600" "<statei> <remaining>" (fni "\xf001")) -                      (mpd "mopidy" "6669" "<statei> <ppos>/<plength> <remaining>" -                       (fni "\xf1bc")) - --- "https://wttr.in?format=" ++ fnn 3 "%c" ++ "+%t+%C+%w++" ++ fnn 1 "%m" -wttrURL l = "https://wttr.in/" ++ l ++ "?format=" ++ fmt -  where fmt = fnn 2 "+%c+" ++ "+%t+%C+" ++ fn 5 "%w" -        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 +music = concatMonitor "  " m ms +  where  m = mpd "mpd" "6600" "<statei> <remaining>" icm +         ms = mpd "mopidy" "6669" "<statei> <ppos>/<plength> <remaining>" ics +         icm = fni "\xf001" +         ics = fni "\xf1bc"  config p = (baseConfig p) {    position = TopSize C 100 (defaultHeight - 1) @@ -61,7 +29,6 @@ config p = (baseConfig p) {                     defaultHeight - 6, defaultHeight - 8,                     defaultHeight - 8, defaultHeight - 8]    , border = FullB -  , alpha = 229    , commands = [ Run (topProcL p)                 , Run m                 , Run (thinkTemp p) @@ -81,7 +48,6 @@ config p = (baseConfig p) {                 , Run laTime                 , Run localTime                 , Run w -- LEGE, LEBL, KCV0 -               -- , Run (ComX "curl" [wttrURL "Edinburgh"] "" "wttr" 18000)                 ]    , template = " "               ++ "|batt0| " @@ -93,17 +59,15 @@ config p = (baseConfig p) {               ++ "</action>  "               ++  ma               ++ " |EGPH| " -             -- ++ " |wttr|"               ++ " {} "               ++ fc (pHigh p) "|elog|"               ++ "|kbd| "               ++ "|multicpu| "               ++ "|multicoretemp| "               ++ " |top| " -             ++ fni "\xf0c9" ++ " |memory| " -             -- ++ dimi "\xf1c0" -             ++ "|diskio| |disku| " -             ++ fni "\xf017" ++ " |datetime| " +             ++ " " ++ fni "\xf0c9" ++ " |memory| " +             ++ " |diskio| |disku| " +             ++ "  |datetime| "               ++ "|laTime| "    } where dimi = fc (pDim p) . fni            m = music diff --git a/src/lib/Config.hs b/src/lib/Config.hs index 5064311..146cf5f 100644 --- a/src/lib/Config.hs +++ b/src/lib/Config.hs @@ -41,7 +41,7 @@ lightPalette = Palette { pNormal = "black"                         , pBorder = "grey80"                         , pForeground = "#000000"                         , pBackground = "white" -                       , pAlpha = 0 +                       , pAlpha = 229                         , pIconRoot = icons "light"                         , pIsLight = True                         } diff --git a/src/lib/Monitors.hs b/src/lib/Monitors.hs index c96666c..8f8f81c 100644 --- a/src/lib/Monitors.hs +++ b/src/lib/Monitors.hs @@ -5,6 +5,8 @@ import Config  import Control.Concurrent  import Control.Concurrent.Async (async)  import Control.Concurrent.STM +import qualified Data.Char as Char +import qualified Text.Printf as Printf  data CombinedMonitor a b = CombinedMonitor a b (String -> String -> String) @@ -102,6 +104,17 @@ weather' tmp st p =  weather = weather' "<skyConditionS> <tempC>° <rh>% <windKmh> (<hour>)" +-- "https://wttr.in?format=" ++ fnn 3 "%c" ++ "+%t+%C+%w++" ++ fnn 1 "%m" +-- , Run (ComX "curl" [wttrURL "Edinburgh"] "" "wttr" 18000) +wttrURL l = "https://wttr.in/" ++ l ++ "?format=" ++ fmt +  where fmt = fnn 2 "+%c+" ++ "+%t+%C+" ++ fn 5 "%w" +        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 +  batt p =    BatteryN ["BAT0"]             ["-t", "<acstatus> <left>" @@ -168,15 +181,19 @@ diskIO p =  -- <fn=1>📨 🖅 🖃 📩 ✉ </fn>  -- (fni "\xf01c \xf03a \xf1fa \xf0e0 \xf1d8 ")  mail p = MailX [ ("I", "jao/inbox", pHigh p) +               , ("h", "jao/hacking", "") +               , ("d", "jao/drivel", "") +               , ("e", "jao/emacs", pDim p) +               , ("g", "jao/gnu", pDim p) +               , ("l", "jao/lists", pDim p) +               , ("L", "jao/lobsters", pDim p) +               , ("b", "jao/bills", pDim p)                 , ("B", "bigml/inbox", pHigh p) -               , ("b", "bigml/bugs", pHigh p)                 , ("S", "bigml/support", "") -               , ("L", "bigml/lists", pDim p) -               , ("G", "jao/geiser", "") -               , ("X", "jao/xmobar", "") +               , ("L", "bigml/lists", "")                 ]                 [ "-d", "~/var/mail" -               , "-p", fc (pHigh p) $ fn 1 "⎘  " -- fc (pLow p) (fni "\xf01c" ++ " ") +               -- , "-p", fc (pHigh p) $ fn 1 "⎘  " -- fc (pLow p) (fni "\xf01c" ++ " ")                 , "-s", " "                 ]                 "mail" @@ -194,7 +211,7 @@ masterVol p =  captureVol = Volume "default" "Capture" ["-t", "<volume>"] 10 -kbd p = Kbd [("us", kbi pDim), ("(unnamed)", kbi pDim), ("us(intl)", kbi pHigh)] +kbd p = Kbd [("us", ""), ("us(intl)", kbi pHigh)] -- kbi pDim    where kbi a = fc (a p) (fni " \xf11c")  brightness = Brightness ["--", "-D", "intel_backlight"] 10 | 
