Added lemuria version of xmonad config
Getty Ritter
9 years ago
1 | {-# LANGUAGE TupleSections #-} | |
2 | ||
3 | import Control.Monad (when, void) | |
4 | import qualified Data.Map as M | |
5 | import Data.Maybe (maybe) | |
6 | import System.Directory (doesFileExist) | |
7 | import System.IO (hPutStrLn) | |
8 | import System.Posix.Env (getEnv) | |
9 | import System.Process (createProcess, proc) | |
10 | ||
11 | import XMonad | |
12 | import XMonad.Hooks.DynamicLog | |
13 | import XMonad.Hooks.ManageDocks (manageDocks, avoidStruts) | |
14 | import XMonad.Layout.Tabbed | |
15 | import XMonad.Util.Run(spawnPipe) | |
16 | ||
17 | data ColorScheme = ColorScheme | |
18 | { normalColor :: String | |
19 | , focusedColor :: String | |
20 | } | |
21 | ||
22 | grayScheme = ColorScheme "#dddddd" "#999999" | |
23 | white = "#ffffff" | |
24 | black = "#000000" | |
25 | ||
26 | myKeys (XConfig {XMonad.modMask = modMask}) = M.fromList | |
27 | [ ((modMask, xK_p), spawn "dmenu_run") | |
28 | ] | |
29 | ||
30 | myLayout = avoidStruts (myTabbed ||| tiled ||| Mirror tiled) ||| Full | |
31 | where tiled = Tall nmaster delta ratio | |
32 | nmaster = 1 | |
33 | ratio = 1/2 | |
34 | delta = 3/100 | |
35 | myTabbed = tabbed shrinkText defaultTheme | |
36 | { activeColor = focusedColor grayScheme | |
37 | , inactiveColor = normalColor grayScheme | |
38 | , activeBorderColor = black | |
39 | , inactiveBorderColor = black | |
40 | , activeTextColor = white | |
41 | , inactiveTextColor = white | |
42 | } | |
43 | ||
44 | workspaceOnScreen :: (WorkspaceId -> WindowSet -> WindowSet) -> | |
45 | WorkspaceId -> X () | |
46 | workspaceOnScreen f w = | |
47 | maybe (return ()) check (lookup w wsMap) | |
48 | where check s = do | |
49 | mws <- screenWorkspace s | |
50 | case mws of | |
51 | Nothing -> windows (f w) | |
52 | Just ws -> do | |
53 | windows (f ws) | |
54 | windows (f w) | |
55 | ||
56 | onScreen :: ScreenId -> [String] -> [(String, ScreenId)] | |
57 | onScreen i ws = map (,i) ws | |
58 | ||
59 | wsMap :: [(String, ScreenId)] | |
60 | wsMap = (onScreen 0 $ words "1 2 3 4 5") ++ | |
61 | (onScreen 1 $ words "6 7 8 9") | |
62 | ||
63 | main :: IO () | |
64 | main = do | |
65 | fehBgExists <- doesFileExist "/home/gdritter/.xm-init" | |
66 | when fehBgExists $ | |
67 | void (createProcess (proc "sh" ["/home/gdritter/.xm-init"])) | |
68 | xmproc <- spawnPipe "/usr/bin/xmobar /home/gdritter/.xmobarrc" | |
69 | xmonad $ defaultConfig | |
70 | { modMask = mod4Mask | |
71 | , terminal = "urxvt" | |
72 | , keys = myKeys <+> keys defaultConfig | |
73 | , layoutHook = myLayout | |
74 | , normalBorderColor = normalColor grayScheme | |
75 | , focusedBorderColor = focusedColor grayScheme | |
76 | , logHook = dynamicLogWithPP $ xmobarPP | |
77 | { ppOutput = hPutStrLn xmproc | |
78 | , ppTitle = xmobarColor "#999999" "" . shorten 50 | |
79 | , ppCurrent = xmobarColor "#999999" "" . ("<" ++) . (++ ">") | |
80 | } | |
81 | } |