module Main (main) where -------------------------------------------------------------------------------- -- | Xmobar binary -- -- Features: -- * Uses the 'UnsafeStdinReader' to receive the current workspace/layout config -- from xmonad -- * FontAwesome and Symbol fonts for icons -- * Some custom plugins (imported below) -- * Theme integration with xmonad (shared module imported below) -- * A custom Locks plugin from my own forked repo import Data.List import Xmobar.Plugins.Bluetooth import Xmobar.Plugins.Device import Xmobar.Plugins.IntelBacklight import Xmobar.Plugins.Screensaver import Xmobar.Plugins.VPN import XMonad (getXMonadDir) import XMonad.Hooks.DynamicLog (wrap, xmobarColor) import qualified XMonad.Internal.Theme as T import Xmobar sep :: String sep = xmobarColor T.backdropFgColor "" " : " aSep :: String aSep = "}{" pSep :: String pSep = "%" myTemplate :: String myTemplate = formatTemplate left right where formatTemplate l r = fmtAliases l ++ aSep ++ fmtAliases r ++ " " left = [ "UnsafeStdinReader" ] right = [ "wlp0s20f3wi" , "enp7s0f1" , "vpn" , "bluetooth" , "alsa:default:Master" , "battery" , "intelbacklight" , "screensaver" , "locks" , "date" ] fmtAliases = intercalate sep . map (wrap pSep pSep) 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 = pSep , alignSep = aSep , template = myTemplate , lowerOnStart = False , hideOnStart = False , allDesktops = True , overrideRedirect = True , pickBroadest = False , persistent = True -- store the icons with the xmonad/xmobar stack project , 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 $ Device ("enp7s0f1", "\xf0e8", T.fgColor, T.backdropFgColor) 5 , Run $ Locks [ "-N", "\x1f13d" , "-n", xmobarColor T.backdropFgColor "" "\x1f13d" , "-C", "\x1f132" , "-c", xmobarColor T.backdropFgColor "" "\x1f132" , "-s", "" , "-S", "" , "-d", " " ] , Run $ Date "%Y-%m-%d %H:%M:%S" "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 = xmobar . config =<< getXMonadDir