xmonad-config/bin/xmobar.hs

126 lines
3.0 KiB
Haskell
Raw Normal View History

2020-03-15 15:10:25 -04:00
import Xmobar.Screensaver
2020-03-15 15:28:48 -04:00
import Data.List
2020-03-15 13:12:01 -04:00
import Xmobar
2020-03-15 13:45:53 -04:00
import XMonad (getXMonadDir)
2020-03-15 13:12:01 -04:00
2020-03-15 13:45:53 -04:00
fgColor0 :: String
2020-03-15 13:12:01 -04:00
fgColor0 = "black"
2020-03-15 13:45:53 -04:00
fgColor1 :: String
2020-03-15 13:12:01 -04:00
fgColor1 = "#888888"
2020-03-15 13:45:53 -04:00
bgColor0 :: String
2020-03-15 13:12:01 -04:00
bgColor0 = "#eeeeee"
2020-03-15 13:45:53 -04:00
bdColor :: String
2020-03-15 13:12:01 -04:00
bdColor = "#cccccc"
2020-03-15 13:45:53 -04:00
wrapColor :: String -> String -> String
2020-03-15 13:12:01 -04:00
wrapColor c s = "<fc=" ++ c ++ ">" ++ s ++ "</fc>"
2020-03-15 13:45:53 -04:00
sep :: String
2020-03-15 13:12:01 -04:00
sep = wrapColor fgColor1 " : "
2020-03-15 13:45:53 -04:00
myTemplate :: String
2020-03-15 15:28:48 -04:00
myTemplate = formatTemplate left right
where
formatTemplate l r = intercalate sep l
++ " }{ "
++ intercalate sep r
++ " "
left = [ "%UnsafeStdinReader%" ]
right = [ "%wlp0s20f3wi%"
, "%alsa:default:Master%"
, "%battery%"
, "%bright%"
, "%screensaver%"
, "%locks%"
, "%date%"
]
2020-03-15 13:12:01 -04:00
2020-03-15 13:45:53 -04:00
config :: String -> Config
config confDir = defaultConfig {
2020-03-15 13:12:01 -04:00
font = "xft:DejaVu Sans Mono:size=11:bold:antialias=true"
, additionalFonts =
[ "xft:FontAwesome:pixelsize=13:antialias=true:hinting=true"
, "xft:Symbola:size=13:bold:antialias=true"
]
, textOffset = 16
, textOffsets = [ 16, 17 ]
, bgColor = bgColor0
, fgColor = fgColor0
, position = BottomSize C 100 24
, border = NoBorder
, borderColor = bdColor
, sepChar = "%"
, alignSep = "}{"
, template = myTemplate
, lowerOnStart = False
, hideOnStart = False
, allDesktops = True
, overrideRedirect = True
, pickBroadest = False
, persistent = True
2020-03-15 13:45:53 -04:00
, iconRoot = confDir ++ "/icons"
2020-03-15 13:12:01 -04:00
, commands =
[ Run $ Alsa "default" "Master"
[ "-t", "<status><volume>%"
, "--"
, "-O", "<fn=1>\xf028</fn>"
, "-o", "<fn=1>\xf026 </fn>"
, "-c", fgColor0
, "-C", fgColor0
]
, Run $ Battery [ "--template", "<acstatus><left>"
, "--Low", "10"
, "--High", "80"
, "--low", "red"
, "--normal", fgColor0
, "--high", fgColor0
, "--"
, "-P"
, "-o" , "<fn=1>\xf0e7</fn>"
, "-O" , "<fn=1>\xf1e6</fn>"
, "-i" , "<fn=1>\xf1e6</fn>"
] 50
, Run $ Brightness ["-t", "<fn=1>\xf185</fn><percent>%"
, "--"
, "-D", "intel_backlight"
] 10
, Run $ Wireless "wlp0s20f3"
[ "-t", "<qualityipat><essid>"
, "--"
, "--quality-icon-pattern", "<icon=wifi_%%.xpm/>"
] 5
, Run $ Locks
[ "-N", "<fn=2>\x1f13d</fn>"
, "-n", wrapColor fgColor1 "<fn=2>\x1f13d</fn>"
, "-C", "<fn=2>\x1f132</fn>"
, "-c", wrapColor fgColor1 "<fn=2>\x1f132</fn>"
, "-s", ""
, "-S", ""
, "-d", "<fn=2> </fn>"
]
, Run $ Date "%Y-%m-%d %H:%M" "date" 10
2020-03-15 15:28:48 -04:00
, Run $ Screensaver ("<fn=1>\xf254</fn>", fgColor0, fgColor1) 10
2020-03-15 15:10:25 -04:00
2020-03-15 13:12:01 -04:00
, Run UnsafeStdinReader
]
}
main :: IO ()
2020-03-15 13:45:53 -04:00
main = do
confDir <- getXMonadDir
xmobar $ config confDir