import Xmobar.Plugins.Bluetooth import Xmobar.Plugins.IntelBacklight import Xmobar.Plugins.Screensaver import Xmobar.Plugins.VPN import qualified Theme as T import Data.List import Xmobar import Xmobar.Common import XMonad (getXMonadDir) -- wrapColor :: String -> String -> String -- wrapColor c s = "" ++ s ++ "" sep :: String sep = wrapColor T.backdropFgColor " : " myTemplate :: String myTemplate = formatTemplate left right where formatTemplate l r = intercalate sep l ++ " }{ " ++ intercalate sep r ++ " " left = [ "%UnsafeStdinReader%" ] right = [ "%wlp0s20f3wi%" , "%vpn%" , "%bluetooth%" , "%alsa:default:Master%" , "%battery%" , "%intelbacklight%" , "%screensaver%" , "%locks%" , "%date%" ] barFont :: String barFont = T.fmtFontXFT T.font { T.family = "DejaVu Sans Mono" , T.size = Just 11 , T.weight = Just T.Bold } iconFont :: String iconFont = T.fmtFontXFT T.font { T.family = "FontAwesome" , T.size = Nothing , T.pixelsize = Just 13 } iconFontLarge :: String iconFontLarge = T.fmtFontXFT T.font { T.family = "FontAwesome" , T.size = Nothing , T.pixelsize = Just 15 } blockFont :: String blockFont = T.fmtFontXFT T.font { T.family = "Symbola" , T.size = Just 13 , T.weight = Just T.Bold } config :: String -> Config config confDir = defaultConfig { font = barFont , additionalFonts = [ iconFont , iconFontLarge , blockFont ] , textOffset = 16 , textOffsets = [ 16, 17, 17 ] , bgColor = T.bgColor , fgColor = T.fgColor , position = BottomSize C 100 24 , border = NoBorder , borderColor = T.bordersColor , sepChar = "%" , alignSep = "}{" , template = myTemplate , lowerOnStart = False , hideOnStart = False , allDesktops = True , overrideRedirect = True , pickBroadest = False , persistent = True , iconRoot = confDir ++ "/icons" , commands = [ Run $ Alsa "default" "Master" [ "-t", "%" , "--" , "-O", "\xf028" , "-o", "\xf026 " , "-c", T.fgColor , "-C", T.fgColor ] , Run $ Battery [ "--template", "" , "--Low", "10" , "--High", "80" , "--low", "red" , "--normal", T.fgColor , "--high", T.fgColor , "--" , "-P" , "-o" , "\xf0e7" , "-O" , "\xf1e6" , "-i" , "\xf1e6" ] 50 , Run $ IntelBacklight "\xf185" , Run $ Wireless "wlp0s20f3" [ "-t", "" , "--" , "--quality-icon-pattern", "" ] 5 , Run $ Locks [ "-N", "\x1f13d" , "-n", wrapColor T.backdropFgColor "\x1f13d" , "-C", "\x1f132" , "-c", wrapColor T.backdropFgColor "\x1f132" , "-s", "" , "-S", "" , "-d", " " ] , Run $ Date "%Y-%m-%d %H:%M" "date" 10 , Run $ Screensaver ("\xf254", T.fgColor, T.backdropFgColor) , Run $ Bluetooth ("\xf293", T.fgColor, T.backdropFgColor) 5 , Run UnsafeStdinReader , Run $ VPN ("\xf023", T.fgColor, T.backdropFgColor) 5 ] } main :: IO () main = do confDir <- getXMonadDir xmobar $ config confDir