xmonad-config/bin/xmobar.hs

151 lines
3.5 KiB
Haskell
Raw Normal View History

2020-03-21 01:18:38 -04:00
import Xmobar.Plugins.Bluetooth
import Xmobar.Plugins.IntelBacklight
import Xmobar.Plugins.Screensaver
2020-03-22 17:17:57 -04:00
import Xmobar.Plugins.VPN
2020-03-15 15:10:25 -04:00
import qualified Theme as T
2020-03-16 13:50:08 -04:00
import Data.List
2020-03-15 15:28:48 -04:00
import Xmobar
import XMonad (getXMonadDir)
2020-03-15 13:12:01 -04:00
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-16 13:50:08 -04:00
sep = wrapColor T.backdropFgColor " : "
2020-03-15 13:12:01 -04:00
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%"
2020-03-22 17:17:57 -04:00
, "%vpn%"
, "%bluetooth%"
2020-03-15 15:28:48 -04:00
, "%alsa:default:Master%"
, "%battery%"
, "%intelbacklight%"
2020-03-15 15:28:48 -04:00
, "%screensaver%"
, "%locks%"
, "%date%"
]
2020-03-15 13:12:01 -04:00
2020-03-16 13:50:08 -04:00
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
}
2020-03-22 17:17:57 -04:00
iconFontLarge :: String
iconFontLarge = T.fmtFontXFT T.font
{ T.family = "FontAwesome"
, T.size = Nothing
, T.pixelsize = Just 15
}
2020-03-16 13:50:08 -04:00
blockFont :: String
blockFont = T.fmtFontXFT T.font
{ T.family = "Symbola"
, T.size = Just 13
, T.weight = Just T.Bold
}
2020-03-15 13:45:53 -04:00
config :: String -> Config
2020-03-20 00:51:36 -04:00
config confDir = defaultConfig
{ font = barFont
2020-03-22 17:17:57 -04:00
, additionalFonts =
[ iconFont
, iconFontLarge
, blockFont
]
2020-03-15 13:12:01 -04:00
, textOffset = 16
2020-03-22 17:17:57 -04:00
, textOffsets = [ 16, 17, 17 ]
2020-03-16 13:50:08 -04:00
, bgColor = T.bgColor
, fgColor = T.fgColor
2020-03-15 13:12:01 -04:00
, position = BottomSize C 100 24
, border = NoBorder
2020-03-16 13:50:08 -04:00
, borderColor = T.bordersColor
2020-03-15 13:12:01 -04:00
, 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
2020-03-20 01:12:20 -04:00
, commands =
2020-03-15 13:12:01 -04:00
[ Run $ Alsa "default" "Master"
[ "-t", "<status><volume>%"
, "--"
, "-O", "<fn=1>\xf028</fn>"
, "-o", "<fn=1>\xf026 </fn>"
2020-03-16 13:50:08 -04:00
, "-c", T.fgColor
, "-C", T.fgColor
2020-03-15 13:12:01 -04:00
]
, Run $ Battery [ "--template", "<acstatus><left>"
, "--Low", "10"
, "--High", "80"
, "--low", "red"
2020-03-16 13:50:08 -04:00
, "--normal", T.fgColor
, "--high", T.fgColor
2020-03-15 13:12:01 -04:00
, "--"
, "-P"
, "-o" , "<fn=1>\xf0e7</fn>"
, "-O" , "<fn=1>\xf1e6</fn>"
, "-i" , "<fn=1>\xf1e6</fn>"
] 50
, Run $ IntelBacklight "<fn=1>\xf185</fn>"
2020-03-20 00:51:36 -04:00
2020-03-15 13:12:01 -04:00
, Run $ Wireless "wlp0s20f3"
[ "-t", "<qualityipat><essid>"
, "--"
, "--quality-icon-pattern", "<icon=wifi_%%.xpm/>"
] 5
, Run $ Locks
2020-03-22 17:17:57 -04:00
[ "-N", "<fn=3>\x1f13d</fn>"
, "-n", wrapColor T.backdropFgColor "<fn=3>\x1f13d</fn>"
, "-C", "<fn=3>\x1f132</fn>"
, "-c", wrapColor T.backdropFgColor "<fn=3>\x1f132</fn>"
2020-03-15 13:12:01 -04:00
, "-s", ""
, "-S", ""
2020-03-22 17:17:57 -04:00
, "-d", "<fn=3> </fn>"
2020-03-15 13:12:01 -04:00
]
, Run $ Date "%Y-%m-%d %H:%M" "date" 10
, Run $ Screensaver ("<fn=1>\xf254</fn>", T.fgColor, T.backdropFgColor)
2020-03-15 15:10:25 -04:00
2020-03-22 17:17:57 -04:00
, Run $ Bluetooth ("<fn=2>\xf293</fn>", T.fgColor, T.backdropFgColor) 5
2020-03-21 01:18:38 -04:00
2020-03-15 13:12:01 -04:00
, Run UnsafeStdinReader
2020-03-21 18:37:26 -04:00
2020-03-22 17:17:57 -04:00
, Run $ VPN ("<fn=2>\xf023</fn>", T.fgColor, T.backdropFgColor) 5
2020-03-15 13:12:01 -04:00
]
}
main :: IO ()
2020-03-15 13:45:53 -04:00
main = do
confDir <- getXMonadDir
xmobar $ config confDir