import Xmobar
import System.Statgrab
-- TODOS:
-- - custom cpu module
-- - custom mem module
-- - custom network/ping module with avg of n pings and blah
-- - custom graph rendering based on braille characters
-- - custom "ramp" thingies 
-- - newsticker?
-- - mail/message monitoring
-- - if possible, different bars per workspace
data CustomCpu = CustomCpu
  deriving (Read, Show)
instance Exec CustomCpu where
  alias CustomCpu = "cpu"
  run CustomCpu = do 
    -- return (show :: IO String (snapshot :: Stats CPUPercent))
    return "meow"
fc code content = "" ++ content ++ ""
sep = fc "#7c6f64"
icon = fc "#d65d0e"
config :: Config
config =
  defaultConfig
    { font = "FiraCode Nerd Font",
      allDesktops = True,
      alpha = 255,
      bgColor = "#282828",
      fgColor = "#ebdbb2",
      commands =
        [ Run $ Xmobar.Memory ["t", "Mem: %"] 10,
          Run $ CustomCpu,
          Run $ Date (icon "\983277" ++ " %Y" ++ sep "-" ++ "%m" ++ sep "-" ++ "%d " ++ icon "\988236" ++ " %H" ++ sep ":" ++ "%M" ++ sep ":" ++ "%S ") "date" 10
        ],
      template = "%memory% }{ %cpu% }{ %date%",
      alignSep = "}{",
      position = TopH 24
    }
main :: IO ()
main = xmobar config  -- or: configFromArgs config >>= xmobar