summaryrefslogtreecommitdiffhomepage
path: root/src/lib/Config.hs
blob: abdfb22813d183596e1aabc85139b4d3d6aab061 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
module Config (Palette, baseConfig, palette, (<~>), defaultHeight) where

import System.Environment (lookupEnv)

import Xmobar

defaultHeight :: Int
defaultHeight = 24

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 = "grey80"
                       , pForeground = "#000000"
                       , pBackground = "white"
                       , pAlpha = 0
                       }

darkPalette :: Palette
darkPalette = Palette { pNormal = "grey60"
                      , pLow = "gray50"
                      , pHigh = "#a0522d"
                      , pFont = "xft:Source Code Pro Medium-10"
                      -- , pFont = "xft:NotoMono-9,xft:Inconsolata-11"
                      , pBorder = "grey30"
                      , pForeground = "grey60"
                      , pBackground = "black"
                      , pAlpha = 0
                      }

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
  , border = NoBorder
  , alpha = (pAlpha p)
  , additionalFonts = []
  , overrideRedirect = True
  , lowerOnStart = True
  , hideOnStart = False
  , allDesktops = True
  , persistent = True
  , sepChar = "|"
  , alignSep = "{}"
  }

(<~>) :: Palette -> [String] -> [String]
(<~>) p args = concat [ args
                      , [ "--low", (pLow p)
                        , "--normal", (pNormal p)
                        , "--high", (pHigh p)
                        ]
                      ]