nix-configs/haskell/xmobar/xmobar.hs

48 lines
1.3 KiB
Haskell
Raw Permalink Normal View History

2023-12-06 20:07:14 +01:00
import Xmobar
2024-02-27 18:18:55 +01:00
import System.Statgrab
2023-12-06 13:14:02 +01:00
-- 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
2024-02-27 18:18:55 +01:00
data CustomCpu = CustomCpu
deriving (Read, Show)
instance Exec CustomCpu where
alias CustomCpu = "cpu"
2024-02-27 18:18:55 +01:00
run CustomCpu = do
-- return (show :: IO String (snapshot :: Stats CPUPercent))
return "meow"
2023-12-06 20:07:14 +01:00
fc code content = "<fc=" ++ code ++ ">" ++ content ++ "</fc>"
2023-12-06 13:14:02 +01:00
2023-12-06 20:07:14 +01:00
sep = fc "#7c6f64"
icon = fc "#d65d0e"
config :: Config
config =
defaultConfig
{ font = "FiraCode Nerd Font",
allDesktops = True,
alpha = 255,
bgColor = "#282828",
fgColor = "#ebdbb2",
commands =
2024-02-27 18:18:55 +01:00
[ Run $ Xmobar.Memory ["t", "Mem: <usedratio>%"] 10,
Run $ CustomCpu,
2023-12-06 20:07:14 +01:00
Run $ Date (icon "\983277" ++ " %Y" ++ sep "-" ++ "%m" ++ sep "-" ++ "%d " ++ icon "\988236" ++ " %H" ++ sep ":" ++ "%M" ++ sep ":" ++ "%S ") "date" 10
],
template = "%memory% }{ %cpu% }{ %date%",
2023-12-06 20:07:14 +01:00
alignSep = "}{",
position = TopH 24
}
main :: IO ()
main = xmobar config -- or: configFromArgs config >>= xmobar