diff options
-rw-r--r-- | xmonad.hs | 57 |
1 files changed, 40 insertions, 17 deletions
@@ -29,16 +29,36 @@ import XMonad.Layout.TwoPane import XMonad.Util.CustomKeys (customKeys) import XMonad.Util.EZConfig (additionalKeys) +-- Colors +data Colors = Colors + { foreground :: String + , background :: String + } + +lightTheme = Colors + { foreground = "#2d9574" + , background = "#fbf8ef" + } + +darkTheme = Colors + { foreground = "#5d4d7a" + , background = "#292b2e" + } + +getColorsFromXtheme :: IO Colors +getColorsFromXtheme = do + x <- readFile "/home/ben/.local/share/xtheme" + return $ case filter (/= '\n') x of + "light" -> lightTheme + "dark" -> darkTheme + _ -> darkTheme + nixBin :: String nixBin = "/home/ben/.nix-profile/bin/" altMask :: KeyMask altMask = mod1Mask --- Colors -cyan = "#2aa198" -- ^ solarized cyan -base3 = "#eee8d4" -- ^ solarized base3 - insKeys :: XConfig l -> [((KeyMask, KeySym), X ())] insKeys conf@(XConfig {modMask = modMask}) = [ ((modMask, xK_y), spawn $ nixBin <> "passmenu") @@ -86,15 +106,16 @@ addSpace = spacingRaw True (Border 5 5 5 5) True -myTabCfg = def { fontName = "xft:mononoki:size=10:ant" - , activeBorderColor = cyan - , inactiveBorderColor = base3 - , activeColor = base3 - , inactiveColor = base3 - } +myTabCfg theme = def + { fontName = "xft:mononoki:size=10:ant" + , activeBorderColor = foreground theme + , inactiveBorderColor = background theme + , activeColor = foreground theme + , inactiveColor = background theme + } -myLayout = avoidStruts $ - noBorders (tabbed shrinkText myTabCfg) -- default tab config +myLayout theme = avoidStruts $ + noBorders (tabbed shrinkText $ myTabCfg theme) -- default tab config ||| tiled ||| Mirror tiled -- ||| noBorders Full @@ -116,17 +137,19 @@ myLayout = avoidStruts $ -- Percent of screen to increment by when resizing panes delta = 3/100 -myConf = additionalKeys c (insKeys c) +myConf theme = additionalKeys c (insKeys c) where c = def { modMask = mod4Mask -- ^ super instead of alt - , normalBorderColor = base3 - , focusedBorderColor = cyan + , normalBorderColor = background theme + , focusedBorderColor = foreground theme , borderWidth = 3 , manageHook = manageDocks <+> manageHook def - , layoutHook = myLayout + , layoutHook = myLayout theme , terminal = "/home/ben/.nix-profile/bin/xterm" , workspaces = myWorkspaces } main :: IO () -main = xmonad $ ewmh $ docks $ myConf +main = do + theme <- getColorsFromXtheme + xmonad $ ewmh $ docks $ myConf theme |