diff options
author | jao <jao@gnu.org> | 2018-12-01 19:13:08 +0000 |
---|---|---|
committer | jao <jao@gnu.org> | 2018-12-01 19:13:08 +0000 |
commit | 1cc4f0c1924e20fad7018307c549cee445afbaf7 (patch) | |
tree | 2354f077dcb885e13b3b8dec8cfd44952b83f5a3 /src/lib/Config.hs | |
parent | 836bcb7286275969ce4b22ad130384652c5821e8 (diff) | |
download | xmobar-config-1cc4f0c1924e20fad7018307c549cee445afbaf7.tar.gz xmobar-config-1cc4f0c1924e20fad7018307c549cee445afbaf7.tar.bz2 |
Directory layout directly usable by xmobar executable
Diffstat (limited to 'src/lib/Config.hs')
-rw-r--r-- | src/lib/Config.hs | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/src/lib/Config.hs b/src/lib/Config.hs new file mode 100644 index 0000000..94b9211 --- /dev/null +++ b/src/lib/Config.hs @@ -0,0 +1,71 @@ +module Config (Palette, baseConfig, palette, (<~>)) where + +import System.Environment (lookupEnv) + +import Xmobar + +data Palette = Palette { pNormal :: String + , pLow :: String + , pHigh :: String + , pFont :: String + , pBorder :: String + , pForeground :: String + , pBackground :: String + , pAlpha :: Int + } + +lightTheme :: IO Bool +lightTheme = fmap (== (Just "light")) (lookupEnv "JAO_COLOR_SCHEME") + +lightPalette :: Palette +lightPalette = Palette { pNormal = "black" + , pLow = "#4d4d4d" + , pHigh = "#a0522d" + , pFont = "xft:Source Code Pro Medium-9" + , pBorder = "grey70" + , pForeground = "#000000" + , pBackground = "white" + , pAlpha = 0 + } + +darkPalette :: Palette +darkPalette = Palette { pNormal = "black" + , pLow = "#4d4d4d" + , pHigh = "#a0522d" + , pFont = "xft:NotoMono-9,xft:Inconsolata-11" + , pBorder = "black" + , pForeground = "grey50" + , pBackground = "black" + , pAlpha = 102 + } + +palette :: IO Palette +palette = do + light <- lightTheme + if light then return lightPalette else return darkPalette + +baseConfig :: Palette -> Config +baseConfig p = defaultConfig { + font = pFont p + , borderColor = pBorder p + , fgColor = (pForeground p) + , bgColor = (pBackground p) + , border = FullBM 1 + , alpha = (pAlpha p) + , additionalFonts = [] + , overrideRedirect = True + , lowerOnStart = True + , allDesktops = True + , hideOnStart = False + , persistent = True + , sepChar = "|" + , alignSep = "{}" + } + +(<~>) :: Palette -> [String] -> [String] +(<~>) p args = concat [ args + , [ "--low", (pLow p) + , "--normal", (pNormal p) + , "--high", (pHigh p) + ] + ] |